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

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ต.ค. 2024

ความคิดเห็น • 182

  • @shubhamtagalpallewar7125
    @shubhamtagalpallewar7125 4 ปีที่แล้ว +30

    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  4 ปีที่แล้ว +6

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

    • @nndsmsjsjs2501
      @nndsmsjsjs2501 ปีที่แล้ว +1

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

    • @Neerajkushwaha-uz8wo
      @Neerajkushwaha-uz8wo 8 หลายเดือนก่อน

      Us😄

  • @sravyayerrams
    @sravyayerrams ปีที่แล้ว +14

    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 3 หลายเดือนก่อน

      Java 8 : pass by value or pass by reference

  • @dheebanm3207
    @dheebanm3207 3 ปีที่แล้ว +3

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

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว +1

      Thanks Dheepu 👍

  • @abhivela
    @abhivela ปีที่แล้ว +3

    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 😊👍

  • @alfiyakhan4580
    @alfiyakhan4580 ปีที่แล้ว

    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.

  • @gsathyanarayana7366
    @gsathyanarayana7366 3 ปีที่แล้ว +6

    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 3 ปีที่แล้ว

      Exactly I got that same doubt

    • @nrusinghacharya
      @nrusinghacharya 3 ปีที่แล้ว +4

      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 3 ปีที่แล้ว +1

      @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!

  • @TheMilinmodi
    @TheMilinmodi 6 หลายเดือนก่อน +1

    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  5 หลายเดือนก่อน

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

  • @avinashkumargond3291
    @avinashkumargond3291 4 หลายเดือนก่อน +1

    Last wala example related to refreneces, was really osm

  • @renejacques8288
    @renejacques8288 3 ปีที่แล้ว +2

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

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว

      Thanks 👍. Yes hopefully 😊

  • @ayyappag7097
    @ayyappag7097 2 ปีที่แล้ว

    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

  • @anurani7084
    @anurani7084 2 ปีที่แล้ว +2

    Thankyou mam.. for explaning this in a wonderful way

  • @yoshitamahajan353
    @yoshitamahajan353 4 ปีที่แล้ว +2

    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  4 ปีที่แล้ว +2

      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  4 ปีที่แล้ว +1

      Now do you get the point?

    • @yoshitamahajan353
      @yoshitamahajan353 4 ปีที่แล้ว

      @@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 ปีที่แล้ว +1

      @@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?

  • @roobanraj28
    @roobanraj28 ปีที่แล้ว +1

    Thanks for this crystal Clear Explanantion .

  • @chaturvedisurbhi05
    @chaturvedisurbhi05 3 ปีที่แล้ว

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

  • @sanketh768
    @sanketh768 2 ปีที่แล้ว +1

    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 2 ปีที่แล้ว

      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 ปีที่แล้ว +1

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

  • @arpanbanejee5143
    @arpanbanejee5143 3 ปีที่แล้ว

    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 < nums.length; 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();
    }

  • @secretsociety2510
    @secretsociety2510 3 ปีที่แล้ว +3

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

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว

      Thanks Amogh for the nice words....

  • @nivassimhadri2229
    @nivassimhadri2229 3 ปีที่แล้ว +2

    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  3 ปีที่แล้ว

      Thanks a ton Nivas 🙂👍

  • @veerannajakkula
    @veerannajakkula 3 ปีที่แล้ว +2

    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.

  • @Asadullah-bg5ny
    @Asadullah-bg5ny 3 ปีที่แล้ว +1

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

  • @WAQASAHMAD-cw1ds
    @WAQASAHMAD-cw1ds 3 ปีที่แล้ว +3

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

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว +1

      Thanks Waqas 👍👍

  • @deepkansara6547
    @deepkansara6547 7 หลายเดือนก่อน

    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 7 หลายเดือนก่อน

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

  • @saikumargoud3257
    @saikumargoud3257 ปีที่แล้ว +1

    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 11 หลายเดือนก่อน

      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
      }
      }

  • @abhishekganguly165
    @abhishekganguly165 3 ปีที่แล้ว

    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 ปีที่แล้ว +1

      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?

  • @omprakash4558
    @omprakash4558 3 ปีที่แล้ว +1

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

  • @dhananajaykrishna8259
    @dhananajaykrishna8259 4 ปีที่แล้ว +2

    Simple and clear explanation. Aweesome!!

  • @sanketh768
    @sanketh768 3 ปีที่แล้ว +1

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

  • @poornachanderraonadipelly6128
    @poornachanderraonadipelly6128 2 ปีที่แล้ว

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

  • @gokudominic3328
    @gokudominic3328 4 ปีที่แล้ว +3

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

    • @CodeDecode
      @CodeDecode  4 ปีที่แล้ว +1

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

    • @gokudominic3328
      @gokudominic3328 4 ปีที่แล้ว +2

      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 ปีที่แล้ว +2

      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.

  • @gargijoshi5186
    @gargijoshi5186 3 ปีที่แล้ว +1

    Best explanation by far

  • @tapanparida3176
    @tapanparida3176 2 ปีที่แล้ว +1

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

    • @CodeDecode
      @CodeDecode  2 ปีที่แล้ว

      Thanks a lot Tapan 🙂👍

  • @navneettripathi2110
    @navneettripathi2110 4 ปีที่แล้ว +1

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

    • @CodeDecode
      @CodeDecode  4 ปีที่แล้ว +1

      . 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 ปีที่แล้ว +2

      @navneet
      All you need to know about comparable and comparator
      Please like and subscribe.
      th-cam.com/play/PLyHJZXNdCXscG1g50RaLZdXgBhC-C7dCy.html

  • @azizbekrasulmetov9293
    @azizbekrasulmetov9293 ปีที่แล้ว

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

  • @sabbaticalcountdown
    @sabbaticalcountdown 3 ปีที่แล้ว +6

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

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว

      You are Welcome ....

  • @akah2
    @akah2 ปีที่แล้ว +1

    Excellent

  • @vigneshramesh7691
    @vigneshramesh7691 3 ปีที่แล้ว +2

    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

  • @drashtinaik5751
    @drashtinaik5751 3 ปีที่แล้ว +2

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

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว +1

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

    • @drashtinaik5751
      @drashtinaik5751 3 ปีที่แล้ว +1

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

    • @drashtinaik5751
      @drashtinaik5751 3 ปีที่แล้ว +1

      @@CodeDecode And thank you for fastest reply.

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว +2

      Sure. You need Java memory management. Right?

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว +1

      No worries 😊😊

  • @SaratKumar-qk7lu
    @SaratKumar-qk7lu 4 ปีที่แล้ว +2

    Good to see this channel.

    • @CodeDecode
      @CodeDecode  4 ปีที่แล้ว

      M glad you liked it

  • @singhji4149
    @singhji4149 8 หลายเดือนก่อน +1

    Great explanation 👌🙏

    • @CodeDecode
      @CodeDecode  8 หลายเดือนก่อน

      Thanks

  • @siddheshtoraskar9537
    @siddheshtoraskar9537 4 ปีที่แล้ว +2

    Great explanation with nice example 👍🏻

  • @prudhvinadh5786
    @prudhvinadh5786 ปีที่แล้ว +1

    Nice explanation

  • @jeeteshkumar11
    @jeeteshkumar11 2 หลายเดือนก่อน +1

    Great explanation

    • @CodeDecode
      @CodeDecode  2 หลายเดือนก่อน

      Thanks 👍

  • @satyamshah9164
    @satyamshah9164 4 ปีที่แล้ว +1

    Very clear explanation mam!

  • @nagar4u
    @nagar4u 3 ปีที่แล้ว +1

    Good content. Keep growing. Keep it up.

  • @pankajchandel1000
    @pankajchandel1000 3 ปีที่แล้ว +1

    Best explanation !

  • @venkatesanelumalai-q5c
    @venkatesanelumalai-q5c ปีที่แล้ว +1

    Nice Video

  • @kasiyedumati9423
    @kasiyedumati9423 3 ปีที่แล้ว +1

    Awesome explanation

  • @abhishekarya8108
    @abhishekarya8108 3 ปีที่แล้ว +1

    Nice explanation!

  • @Rohit-yo4ik
    @Rohit-yo4ik 3 ปีที่แล้ว

    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.

  • @MultiMoonlight
    @MultiMoonlight 8 หลายเดือนก่อน

    Ma'am is your name Sana?

  • @hariprasad2697
    @hariprasad2697 2 ปีที่แล้ว +1

    Super 🌟

  • @aravindhravi2307
    @aravindhravi2307 3 ปีที่แล้ว +1

    THIS IS GR8!!!

  • @paggybhangale
    @paggybhangale ปีที่แล้ว

    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()

  • @gokulaher2476
    @gokulaher2476 3 ปีที่แล้ว +1

    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..

  • @barathiraiyarul4498
    @barathiraiyarul4498 2 ปีที่แล้ว +1

    Thanks 👍

  • @commenter9451
    @commenter9451 2 ปีที่แล้ว +1

    Best explanation ❤️

  • @abhishek_67
    @abhishek_67 2 ปีที่แล้ว

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

  • @akshaydeshmukh1433
    @akshaydeshmukh1433 2 ปีที่แล้ว

    call by rfrnce vs pass by rfrence same or
    dfrnt

  • @sdef719
    @sdef719 3 ปีที่แล้ว +1

    Best explanation. Love it.

  • @NareshKumar-dw9xp
    @NareshKumar-dw9xp 4 ปีที่แล้ว +1

    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  4 ปีที่แล้ว +1

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

    • @NareshKumar-dw9xp
      @NareshKumar-dw9xp 4 ปีที่แล้ว +2

      @@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  4 ปีที่แล้ว +2

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

    • @CodeDecode
      @CodeDecode  4 ปีที่แล้ว +2

      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  4 ปีที่แล้ว +1

      All the best for the future companies. 👍

  • @AMANSINGH-yv4vv
    @AMANSINGH-yv4vv หลายเดือนก่อน +1

    Thanks so much ya!

    • @CodeDecode
      @CodeDecode  หลายเดือนก่อน

      🙂👍

  • @asutoshsahoo3776
    @asutoshsahoo3776 4 ปีที่แล้ว +2

    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 ปีที่แล้ว +1

      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 4 ปีที่แล้ว +1

      Then what exactly pass by reference?

    • @abhishekganguly165
      @abhishekganguly165 3 ปีที่แล้ว

      @@deneshbabu5199 same question bhai.

  • @hasangalakdinu
    @hasangalakdinu 4 หลายเดือนก่อน +1

    thanks!!!

    • @CodeDecode
      @CodeDecode  4 หลายเดือนก่อน

      You're welcome!

  • @swapnilhadge7383
    @swapnilhadge7383 3 ปีที่แล้ว

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

  • @hhcdghjjgsdrt235
    @hhcdghjjgsdrt235 ปีที่แล้ว +2

    you rock

  • @siddharthb2226
    @siddharthb2226 3 ปีที่แล้ว +1

    vera level

  • @sharfan22010
    @sharfan22010 4 ปีที่แล้ว +1

    Thankyou miss👍

  • @temuryakhyoev5922
    @temuryakhyoev5922 3 ปีที่แล้ว

    still a bit confusing about pass the object as a parameter

  • @sahilbhasin2112
    @sahilbhasin2112 4 ปีที่แล้ว +1

    gud job

  • @SaiAbitathaDUCIC
    @SaiAbitathaDUCIC 3 ปีที่แล้ว +1

    My exam begins in 2 hours 🙏

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว

      All the best 👍💯

  • @guntakasomeshwar8262
    @guntakasomeshwar8262 3 ปีที่แล้ว

    I am unable to understand madam

  • @unknownuser-wr3zm
    @unknownuser-wr3zm 3 ปีที่แล้ว +1

    tq

  • @nazimmohammad6984
    @nazimmohammad6984 3 ปีที่แล้ว

    Pl make it more clear.

  • @achyuth2424
    @achyuth2424 4 ปีที่แล้ว

    Not understood please give more detail easy way of understanding

    • @CodeDecode
      @CodeDecode  4 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      @@CodeDecode more examples please

  • @hasnainansari6279
    @hasnainansari6279 4 ปีที่แล้ว +1

    I m still confused ⁉️

    • @CodeDecode
      @CodeDecode  4 ปีที่แล้ว +1

      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  4 ปีที่แล้ว

      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?

  • @lazylizarts
    @lazylizarts 2 ปีที่แล้ว +2

    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

  • @cousinslove7209
    @cousinslove7209 3 ปีที่แล้ว +1

    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

  • @divyagracie
    @divyagracie 2 ปีที่แล้ว

    02:51

  • @horuscoming
    @horuscoming 4 ปีที่แล้ว +1

    You got to activate windows.

    • @CodeDecode
      @CodeDecode  4 ปีที่แล้ว

      Yeah will do that for sure...

  • @sudipghimire4823
    @sudipghimire4823 3 ปีที่แล้ว +1

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

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว +1

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

  • @hey_babe1557
    @hey_babe1557 3 ปีที่แล้ว +1

    The video views is equal to your subscriber count

    • @CodeDecode
      @CodeDecode  3 ปีที่แล้ว +1

      Nice observation Pradeep🙂👍

    • @hey_babe1557
      @hey_babe1557 3 ปีที่แล้ว

      @@CodeDecode 😁

  • @venkatesanelumalai-q5c
    @venkatesanelumalai-q5c ปีที่แล้ว +1

    Good Video