Java is pass/call by value or pass/call by reference [MOST IMP. JAVA INTERVIEW QUESTION]| ode Decode

Ғылым және технология

In this video of code decode we will figure out if Java is pass/call by value or pass/call by reference.
This is very important and most controversial topic in Java
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
openinapp.co/udemycourse
Course Description Video :
yt.openinapp.co/dmjvd
Any programming language can be either pass by value or pass by reference. Now the most frequently asked interview question is what is java ? A pass by value or pass by reference?
In this video we will try to figure this out.
In this video of is java pass by value or pass by reference we will try some demo examples to prove why is java pass by value though it seems to be pass by reference.
Answer to why is java pass by value or pass by reference
java pass by reference or pass by value,pass by value and pass by reference in java,pass by value and pass by reference in java by durga sir,is java pass by value or pass by reference,is java call by value or call by reference,java call by value and call by reference,is java ca by value or call by refrrence
---------------------------------------------------------------------------
#javapassbyvalueorpassbyreference #java #passbyvalueorreference

Пікірлер: 179

  • @shubhamtagalpallewar7125
    @shubhamtagalpallewar71253 жыл бұрын

    Thank you ma'am, I have been asked this question in interview and I was unable to answer properly, now I am confident on this topic.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    M glad that you are. :) May you reach all the heights in your career

  • @nndsmsjsjs2501

    @nndsmsjsjs2501

    Жыл бұрын

    @@CodeDecode mam pass By Value Means Call by value Right?

  • @Neerajkushwaha-uz8wo

    @Neerajkushwaha-uz8wo

    5 ай бұрын

    Us😄

  • @sravyayerrams
    @sravyayerrams Жыл бұрын

    Pass By Reference: Changing the value of the real address in the memory. Pass By Value: Copying the value to another location and so the real value is not changed.(java)

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    👍👍

  • @amitjoshi940

    @amitjoshi940

    25 күн бұрын

    Java 8 : pass by value or pass by reference

  • @avinashkumargond3291
    @avinashkumargond3291Ай бұрын

    Last wala example related to refreneces, was really osm

  • @anurani7084
    @anurani7084 Жыл бұрын

    Thankyou mam.. for explaning this in a wonderful way

  • @renejacques8288
    @renejacques82883 жыл бұрын

    Clear explanation. I hope that'll help not to forget it again.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks 👍. Yes hopefully 😊

  • @dheebanm3207
    @dheebanm32073 жыл бұрын

    Real time example is very easy to understand, thank you...

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks Dheepu 👍

  • @secretsociety2510
    @secretsociety25103 жыл бұрын

    This is very helpful video. Thanks a lot for explaining this👍

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks Amogh for the nice words....

  • @WAQASAHMAD-cw1ds
    @WAQASAHMAD-cw1ds3 жыл бұрын

    Thank you so much Ma'm to clearing my Concept... & Congratulations for a new subscriber 😉

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks Waqas 👍👍

  • @sanketh768
    @sanketh7683 жыл бұрын

    Thanks mam, please continue to make videos like these to help people. Maybe after java sometother topic like database

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Yes, definitely

  • @veerannajakkula
    @veerannajakkula3 жыл бұрын

    Good explanation. Thank You. You can also pass any list to a method and update the list in called method to provide more in-depth analysis.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Sure 👍

  • @dhananajaykrishna8259
    @dhananajaykrishna82593 жыл бұрын

    Simple and clear explanation. Aweesome!!

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks 👍

  • @siddheshtoraskar9537
    @siddheshtoraskar95373 жыл бұрын

    Great explanation with nice example 👍🏻

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks 👍

  • @SaratKumar-qk7lu
    @SaratKumar-qk7lu3 жыл бұрын

    Good to see this channel.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    M glad you liked it

  • @abhivela
    @abhivela Жыл бұрын

    The topics you cover here are so unique !!! I have seen many tutorials for Java..... But the type of topics you cover here and the explanation is top notch!!! ❤ Thank you for your efforts 🎉❤

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Thanks Abhi 😊👍

  • @sharfan22010
    @sharfan220103 жыл бұрын

    Thankyou miss👍

  • @nagar4u
    @nagar4u3 жыл бұрын

    Good content. Keep growing. Keep it up.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks 👍

  • @roobanraj28
    @roobanraj28 Жыл бұрын

    Thanks for this crystal Clear Explanantion .

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    👍🙂

  • @Asadullah-bg5ny
    @Asadullah-bg5ny3 жыл бұрын

    what a brilliant way of explaining , finally got the answer.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks 🙃

  • @navneettripathi2110
    @navneettripathi21104 жыл бұрын

    Commenting for the 3rd time....for comparable comparator detailed video...

  • @CodeDecode

    @CodeDecode

    4 жыл бұрын

    . Sorry for keeping your topic on hold. I needed to cover basics first for that video. Now since we have covered most of the basics we can take that topic now.

  • @CodeDecode

    @CodeDecode

    4 жыл бұрын

    @navneet All you need to know about comparable and comparator Please like and subscribe. kzread.info/head/PLyHJZXNdCXscG1g50RaLZdXgBhC-C7dCy

  • @sdef719
    @sdef7193 жыл бұрын

    Best explanation. Love it.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks 👍

  • @sabbaticalcountdown
    @sabbaticalcountdown3 жыл бұрын

    You did an excellent job explaining, thank you so much!! =)

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    You are Welcome ....

  • @tapanparida3176
    @tapanparida31762 жыл бұрын

    God bless you mam for your good work…your work really helps people….keep up!!!

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks a lot Tapan 🙂👍

  • @nivassimhadri2229
    @nivassimhadri22292 жыл бұрын

    seen many videos from your channel, everything is on point explanation and also the slides are perfect to read even though there is no audio. where can we find all your presentation slides?

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks a ton Nivas 🙂👍

  • @satyamshah9164
    @satyamshah91644 жыл бұрын

    Very clear explanation mam!

  • @CodeDecode

    @CodeDecode

    4 жыл бұрын

    Thanks :)

  • @gargijoshi5186
    @gargijoshi51862 жыл бұрын

    Best explanation by far

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks Gargi

  • @kasiyedumati9423
    @kasiyedumati94233 жыл бұрын

    Awesome explanation

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks 👍👍

  • @TheMilinmodi
    @TheMilinmodi2 ай бұрын

    Thank you so much mam. Much clear till you convinced that java is pass by value but when you explained with java object then it becomes confusing. Please explain in detail for when we are changing the value using object. Also, Congratulations to you for new subscriber as well. Gone thru channel and found it very helpful.

  • @CodeDecode

    @CodeDecode

    2 ай бұрын

    Sure we will create a more clarity video on this. Thanks 👍

  • @pankajchandel1000
    @pankajchandel10002 жыл бұрын

    Best explanation !

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks sanjay

  • @akah2
    @akah2 Жыл бұрын

    Excellent

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    thanks

  • @commenter9451
    @commenter94512 жыл бұрын

    Best explanation ❤️

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks

  • @aravindhravi2307
    @aravindhravi23073 жыл бұрын

    THIS IS GR8!!!

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Thanks 👍👍

  • @singhji4149
    @singhji41495 ай бұрын

    Great explanation 👌🙏

  • @CodeDecode

    @CodeDecode

    5 ай бұрын

    Thanks

  • @sahilbhasin2112
    @sahilbhasin21124 жыл бұрын

    gud job

  • @CodeDecode

    @CodeDecode

    4 жыл бұрын

    Thanks :)

  • @abhishekarya8108
    @abhishekarya81082 жыл бұрын

    Nice explanation!

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks abhishek

  • @prudhvinadh5786
    @prudhvinadh5786 Жыл бұрын

    Nice explanation

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    Thanks 😊👍

  • @hasangalakdinu
    @hasangalakdinuАй бұрын

    thanks!!!

  • @CodeDecode

    @CodeDecode

    Ай бұрын

    You're welcome!

  • @user-os2ho7yq7q
    @user-os2ho7yq7q10 ай бұрын

    Nice Video

  • @CodeDecode

    @CodeDecode

    10 ай бұрын

    Thanks

  • @drashtinaik5751
    @drashtinaik57513 жыл бұрын

    It is perfect explanation. But still, can you please add new video on this with detail explanation and example.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Sure Drashti, what do u want us to cover in that?

  • @drashtinaik5751

    @drashtinaik5751

    3 жыл бұрын

    @@CodeDecode In detail with heap and stack memory allocation that will give much clarity .

  • @drashtinaik5751

    @drashtinaik5751

    3 жыл бұрын

    @@CodeDecode And thank you for fastest reply.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Sure. You need Java memory management. Right?

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    No worries 😊😊

  • @vigneshramesh7691
    @vigneshramesh76913 жыл бұрын

    With the Last example all the doubts are cleared that Java is pass by value. "Just passing a reference as value. " 8:12 - 8:16

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    👍👍m glad you understood this so clearly 👍 appreciable

  • @user-os2ho7yq7q
    @user-os2ho7yq7q10 ай бұрын

    Good Video

  • @CodeDecode

    @CodeDecode

    10 ай бұрын

    Thanks

  • @alfiyakhan4580
    @alfiyakhan458010 ай бұрын

    Ma'am I am having a doubt, starting 4 mins of the video where you said "to access a private method you have to make it static", I didn't get that point. Please explain.

  • @siddharthb2226
    @siddharthb22262 жыл бұрын

    vera level

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks

  • @hariprasad2697
    @hariprasad26972 жыл бұрын

    Super 🌟

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Thanks hari

  • @barathiraiyarul4498
    @barathiraiyarul44982 жыл бұрын

    Thanks 👍

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    👍

  • @sanketh768
    @sanketh7682 жыл бұрын

    nice explanation however had a doubt, since java is pass by reference for object as per your example for Animal Object. i tried the same example with Integer since its an Object, the same was not happening. Please check the below example. public static void main(String[] args) { Integer i = 10; change(i); System.out.println("main"+i);//op is 10 } public static void change(Integer i) { i =11; System.out.println("method"+i);//op is 11 }

  • @thivagarmurugan2955

    @thivagarmurugan2955

    Жыл бұрын

    u creating primitive datatypes in main function and u just passing copy of i in change method so any changes made in change only affected in change alone not in main method the both different

  • @niteshbhati6496

    @niteshbhati6496

    9 ай бұрын

    It is because all primitive wrapper classes (Integer, Byte, Long, Float, Double, Character, Boolean, and Short) are immutable in Java

  • @arpanbanejee5143
    @arpanbanejee51433 жыл бұрын

    Its still not clear to me- Example 1- If I just add tempList in my base case then I get [] [] [] [] as and, as it holds the reference and it gets modified in the recursive calls, so at each step when it hits the base case I need to capture the then state of the arraylist and store it in the res. private static void backtrack(List list, List tempList, int[] nums, int remain, int start) { if (start >= nums.length && remain != 0) { return; } else if (remain == 0) { list.add(new ArrayList(tempList));--> if I do not make a new list out of it , it gets modified. REFERENCE VAIRABLE THATS WHY!! } else { for (int i = start; i if (nums[i] > remain) { break; } if ((i > start && nums[i] == nums[i - 1])) { continue; // skip duplicates } tempList.add(nums[i]); backtrack(list, tempList, nums, remain - nums[i], i + 1); tempList.remove(tempList.size() - 1); } } } But in this example, even if I set the prev pointer when my left recurison ends for the first time ,still its value is null when it backtracks- private void convertBtToDll(Node temp, Node prev) { if (temp == null) { return; } convertBtToDll(temp.left, prev); // marks the head -- leftmost node if (prev == null) { head = temp; } // make the links for the other nodes else { temp.left = prev; prev.right = temp; } prev = temp; ----> even if I set it here it is null?????? why? isn't it a reference variable? convertBtToDll(temp.right, prev); } public static void main(String[] args) { ConvertBTtoDLL2 btToDll = new ConvertBTtoDLL2(); Node root = new Node(10); root = new Node(10); root.left = new Node(12); root.right = new Node(15); root.left.left = new Node(25); root.left.right = new Node(30); root.right.left = new Node(36); System.out.println("After conversion to DLL"); Node temp = root; Node prev = null; btToDll.convertBtToDll(temp, prev); btToDll.printDll(); }

  • @hhcdghjjgsdrt235
    @hhcdghjjgsdrt235 Жыл бұрын

    you rock

  • @CodeDecode

    @CodeDecode

    Жыл бұрын

    :)

  • @omprakash4558
    @omprakash45582 жыл бұрын

    So can we say, java is pass by reference for non-premitive data types?

  • @saikumargoud3257
    @saikumargoud3257 Жыл бұрын

    Thank you mam I had understand very clearly but one doubt raised in mind that why java is particularly called pass by value here we are doing both pass by value and pass by reference can you please explain mam?

  • @vigneshgvs

    @vigneshgvs

    7 ай бұрын

    chatgpt gave below sample on justification: In Java, you always pass the value of the reference to an object when you pass it to a method. This means you are passing a copy of the reference, not the actual object. Java itself does not provide a way to pass the actual object by reference as some other languages might. Even when you pass an object as a method parameter, you're still passing a copy of the reference to that object. (kindda pass by value). However, the confusion often arises because operations on the object itself (like modifying its fields) are visible outside the method, giving the appearance that the object is being passed by reference. class Person { String name; Person(String name) { this.name = name; } } public class Main { public static void modifyReference(Person person) { person = new Person("John"); // This reassigns the reference locally, not affecting the original reference. } public static void modifyObjectFields(Person person) { person.name = "Jane"; // This modifies the actual object, affecting the original object. } public static void main(String[] args) { Person person = new Person("Alice"); modifyReference(person); System.out.println(person.name); // Output: Alice modifyObjectFields(person); System.out.println(person.name); // Output: Jane } }

  • @gokulaher2476
    @gokulaher24763 жыл бұрын

    java is strictly pass-by-value method 'arguments' "value" initializes and assigns newly created method 'parameter'value

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    That's what we have discussed here also right?

  • @gokulaher2476

    @gokulaher2476

    3 жыл бұрын

    Perfect... Your video on java 8 Predicate,function, supplier,consumer Bi.... Predicate, fu,ction,consumer and stream are very well explained..

  • @unknownuser-wr3zm
    @unknownuser-wr3zm3 жыл бұрын

    tq

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    👍

  • @chaturvedisurbhi05
    @chaturvedisurbhi052 жыл бұрын

    So we can say reference is passed as value so reference doesn't change but object value gets change in case of passing reference?

  • @gsathyanarayana7366
    @gsathyanarayana73663 жыл бұрын

    Thank You for making this video. Need small clarification, when primitive variable 'a' passed as an argument to a method you said java copies the value of 'a' to a new memory location and that location address passed to that method as argument so value wouldn't update in parent class ? Same theory isn't applicable to objects ? Java doesn't copy the object to different memory location and sends that memory location address to method as an argument ?

  • @abduldaniq5004

    @abduldaniq5004

    2 жыл бұрын

    Exactly I got that same doubt

  • @nrusinghacharya

    @nrusinghacharya

    2 жыл бұрын

    The problem you're facing here is statements like In Java, Objects are passed by reference, and primitives are passed by value. This is half incorrect. Everyone can easily agree that primitives are passed by value; there's no such thing in Java as a pointer/reference to a primitive. However, Objects are not passed by reference. A correct statement would be Object references are passed by value.

  • @shiva3895

    @shiva3895

    2 жыл бұрын

    @code_decode small question. If java is pass by value & values is passed after copying it. That means object reference value should also be copied first and than passed. If Yes, a memory address is being copied and that is my missconcecpt. Can you please explain. Thanks!

  • @temuryakhyoev5922
    @temuryakhyoev59223 жыл бұрын

    still a bit confusing about pass the object as a parameter

  • @Rohit-yo4ik
    @Rohit-yo4ik2 жыл бұрын

    Today this question asked by interviwer...I got trapped... there is mutable/immutable thing also matter to this pass by value or reference. Please clear this also.

  • @poornachanderraonadipelly6128
    @poornachanderraonadipelly61282 жыл бұрын

    Mam im getting really confused with this concept? Please help me to understand

  • @swapnilhadge7383
    @swapnilhadge73833 жыл бұрын

    You missed to mention difference between int and animal ...

  • @ayyappag7097
    @ayyappag70972 жыл бұрын

    Need small clarification, when primitive variable 'a' passed as an argument to a method you said java copies the value of 'a' to a new memory location and that location address passed to that method as argument so value wouldn't update in parent class ? Same theory isn't applicable to objects ? Java doesn't copy the object to different memory location and sends that memory location address to method as an argument ?

  • @vaniraj8456

    @vaniraj8456

    Жыл бұрын

    No here because we send the reference variable which holds the memory address of an object rather than holding the object

  • @nazimmohammad6984
    @nazimmohammad69842 жыл бұрын

    Pl make it more clear.

  • @akshaydeshmukh1433
    @akshaydeshmukh1433 Жыл бұрын

    call by rfrnce vs pass by rfrence same or dfrnt

  • @SaiAbitathaDUCIC
    @SaiAbitathaDUCIC3 жыл бұрын

    My exam begins in 2 hours 🙏

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    All the best 👍💯

  • @paragbhangale
    @paragbhangale Жыл бұрын

    how to write junit ? myovject oldermethod() { other call// hashmap map = new hashmap(): NewObj obj = service.myservice(map); //logic value = map.get(0); // here i am getting null pointer in junit test return myobject; } class myservice{ NewObj myservice(hashmap map) { //logic map.put(key,value): return Newobj; } } after that i am getting null if i mock the myservice ...how to write junit for oldermethod()

  • @azizbekrasulmetov9293
    @azizbekrasulmetov9293 Жыл бұрын

    Did u said that u a passing object by value at the end ? When u actually passing the reference!

  • @asutoshsahoo3776
    @asutoshsahoo37764 жыл бұрын

    Got it that , the reference we pass in java function is as a reference to memory location as value, so though we pass a reference it is still Pass by Value, but then what is Pass by Reference exactly

  • @CodeDecode

    @CodeDecode

    4 жыл бұрын

    Your understanding is correct. Pass by reference is just a concept where you pass reference of variable or so called memory address of that variable itself as the formal argument. Doing so, if you change any thing locally in the method, the changes are no more local to that method, it's reflected every where Why so? Because you changed at the memory itself. Right? Now you got it ? If it would have been pass by value, different memory location is created for the formal argument and value will be copied. Hence if you change that value locally, the changes will be in newly created memory location and not in the original one

  • @deneshbabu5199

    @deneshbabu5199

    3 жыл бұрын

    Then what exactly pass by reference?

  • @abhishekganguly165

    @abhishekganguly165

    3 жыл бұрын

    @@deneshbabu5199 same question bhai.

  • @yoshitamahajan353
    @yoshitamahajan3533 жыл бұрын

    In pass by value u mean the value doesn't change and in pass by reference value changed so ideally value changes when reference passed so it should be pass by reference?? Do let me know as I m still confused about this so

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Ok so let's understand it in this way. Reference is nothing but memory address. Now when ever you change any thing at memory address, the change is reflected every where. Now in case of Java, This memory address is sent as values in arguments to methods. So it's pass by value, but since memory address or reference is passed as values hence changes are reflected every where

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Now do you get the point?

  • @yoshitamahajan353

    @yoshitamahajan353

    3 жыл бұрын

    @@CodeDecode and same in case of pass by value we create copy of the variable and pass the copy.. so again we pass value.. 1. In call by value , we create copy of the value and pass to the method 2. In call by reference,we pass the value of memory address to which the object is passed So in both cases value is passed hence java is call by value Am I r8? Please correct me if I m wrong..

  • @abhishekganguly165

    @abhishekganguly165

    3 жыл бұрын

    @@yoshitamahajan353 but both point 1 and 2 got satisfied right? so why this is only pass by value?? why it is not pass by refrerance?

  • @deepkansara6547
    @deepkansara65473 ай бұрын

    Consider this snippet: public static void main(String[] args) { Integer i = new Integer(3); modify(i); System.out.println(i); //Prints 3 } static void modify(Integer i) { i = i * 10; } In this case I have created the object of the Integer class and changed it's value. So as per this video, object can be changed as it is passed as a reference, I am getting the output as the same object it has been initialized with instead of modified version. In case of arrays, we can do modify the values of array. So I just want to know what kind of values are passed by value and what kind of values are passed by reference?? Anyone please help.

  • @arpit2283

    @arpit2283

    3 ай бұрын

    Bro, String and Wrapper classes like Integer , Double , BigDecimal are immutable classes. So , the value is not changed there.

  • @abhishek_67
    @abhishek_672 жыл бұрын

    Hum value bhi pass kr rhe hai aur object reference bhi pass kr pa rahe hai to java sirf passed by value kyu 🤔?

  • @divyagracie
    @divyagracie Жыл бұрын

    02:51

  • @abhishekganguly165
    @abhishekganguly1653 жыл бұрын

    Hi mam, In 1:18- 1:21 aapne kaha ki "we are changing the value at the real address in the memory" this is pass by referance. and that is what is happening in your last example. when you passes a value the it is changing its value. If you are passing a referance, then the address of the object is getting copied, and it is changing the value inside that object. So can you Please expain me in details for call by referance with a heap and stack memory representation. if possible.

  • @abhishekganguly165

    @abhishekganguly165

    3 жыл бұрын

    I got it first in google search that: Pass-by-reference means to pass the reference of an argument in the calling function to the corresponding formal parameter of the called function. The called function can modify the value of the argument by using its reference passed in. The following example shows how arguments are passed by reference. So why cant we say java supports both. ?

  • @sriharikaranam3330

    @sriharikaranam3330

    3 жыл бұрын

    Java mainly dealing with 2 types.. 1. Primitive 2. Object In first case java is passing primitive value as argument of method. So any changes happened in method then new primitive will be created(which is short lived variable). It wont affect original primitive. In second case, lets say reference is 101011. Then java is passing that reference as argument of method. If any changes happened, reference value not get affected. Java will modify the object which is pointing to that reference. The reference value will be maintained as same. So Java is pass by value... In first case if original value changed, or in second case if the reference got changed, then it will be pass by reference..

  • @abhishekganguly165

    @abhishekganguly165

    3 жыл бұрын

    @@sriharikaranam3330 what you told I got. but point is what is pass by reference then? we will pass the referance and address will be change? or pass by reference is we pass the referance and the value inside the referance got change?

  • @hey_babe1557
    @hey_babe15572 жыл бұрын

    The video views is equal to your subscriber count

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Nice observation Pradeep🙂👍

  • @hey_babe1557

    @hey_babe1557

    2 жыл бұрын

    @@CodeDecode 😁

  • @MultiMoonlight
    @MultiMoonlight5 ай бұрын

    Ma'am is your name Sana?

  • @NareshKumar-dw9xp
    @NareshKumar-dw9xp3 жыл бұрын

    Yesterday I had an interview with Nokia , it was an on-campus placement interview.. You know what, they asked me why java is passed by value ? And they wouldn't satisfied with my answer. And hence I got rejected ☹️☹️.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Was I able to clear your query? Did you watch this video before or you watched this now?

  • @NareshKumar-dw9xp

    @NareshKumar-dw9xp

    3 жыл бұрын

    @@CodeDecode That's the unfortunate mam. I watched it now. But noww I am clear amd confident. Probably next week I have an interview of TCS Digital SDE . I will never repeat this mistake ever. Thank you so much for this.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Don't worry. As a fresher you will get ample of opportunities and each interview will teach you something new.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Take it positively. Just make sure that you are clear with your basics. They will not go much high level. Prepare core Java thoroughly and I am sure you will crack something really worth cracking 👍

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    All the best for the future companies. 👍

  • @gokudominic3328
    @gokudominic33284 жыл бұрын

    Why java is not both i.e. java is pass by value as well as pass by reference.??plzz ans

  • @CodeDecode

    @CodeDecode

    4 жыл бұрын

    Because Java is pass by value. That's why it's not both.

  • @gokudominic3328

    @gokudominic3328

    4 жыл бұрын

    No mam i mean java is always pass by value but by vedio java is seems to be both so how can you say tha pass by reference is equivalent to pass by value??

  • @gokudominic3328

    @gokudominic3328

    4 жыл бұрын

    My actual question is how pass by reference is equivalent to pass by value??

  • @CodeDecode

    @CodeDecode

    4 жыл бұрын

    Consider a scenerio : You are passing address or memory location itself.

  • @CodeDecode

    @CodeDecode

    4 жыл бұрын

    So while you are passing your variable as formal argument of the method, it is considered as pass by value. So yes you are correct when you say it's pass by value but actually in java, you pass memory reference itself as a value.

  • @lazylizarts
    @lazylizarts2 жыл бұрын

    JAVA IS ALWAYS PASS BY VALUE ALWAYS

  • @CodeDecode

    @CodeDecode

    2 жыл бұрын

    Can you please explain how?

  • @lazylizarts

    @lazylizarts

    2 жыл бұрын

    @@CodeDecode its appropriate to say "Object reference is passed by value" for Non primitive type

  • @hasnainansari6279
    @hasnainansari62793 жыл бұрын

    I m still confused ⁉️

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    java is pass by value. But if you pass a reference variable as an argument and that changes then it is because you are passing memory reference as value. Hence it's never pass by reference. It's always pass by value.

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Still confused??

  • @littlethings2250

    @littlethings2250

    3 жыл бұрын

    @@CodeDecode : passing memory reference as a value? But here we are not working on copy, instead the actual object itself isn't it? And in C, the concept of pointers and reference, there we pass reference as a reference or value?

  • @achyuth2424
    @achyuth24244 жыл бұрын

    Not understood please give more detail easy way of understanding

  • @CodeDecode

    @CodeDecode

    4 жыл бұрын

    Explaination : java is pass by value. But if you pass a reference variable as an argument and that changes then it is because you are passing memory reference as value. Hence it's never pass by reference. It's always pass by value. Still if it's not clear then please let me know I will put more examples for you.

  • @achyuth2424

    @achyuth2424

    4 жыл бұрын

    @@CodeDecode more examples please

  • @narasimhakaranth9824

    @narasimhakaranth9824

    3 жыл бұрын

    @@CodeDecode what that "value" is called? thas not memory address right?

  • @guntakasomeshwar8262
    @guntakasomeshwar82622 жыл бұрын

    I am unable to understand madam

  • @cousinslove7209
    @cousinslove72093 жыл бұрын

    Slow slow madam , not all members are quick learners as like you

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    Will try to reduce pace from next videos 👍

  • @GameXanime63

    @GameXanime63

    3 жыл бұрын

    U can do by urself if u don't know the playback option just click on the three dot and u can this playback option where u can reduce the speed of the vdo btw thank me later

  • @horuscoming
    @horuscoming4 жыл бұрын

    You got to activate windows.

  • @CodeDecode

    @CodeDecode

    4 жыл бұрын

    Yeah will do that for sure...

  • @sudipghimire4823
    @sudipghimire48233 жыл бұрын

    This is too much of a hindi accent to take in..

  • @CodeDecode

    @CodeDecode

    3 жыл бұрын

    We are so sorry Sudip that our mother tongue is hindi. 👍

Келесі