Комментарии:
This concept is very confusing to explain, especially to trainee devs even now being a senior dev for a fairly long time.
Basically, there is no such thing in Java as pass-by-reference. As already pointed out, the primitive explanation is correct. Primitives reside on the stack. A copy of the value is passed to the method param and cannot be changed.
Objects are stored in the heap. When the object reference is passed to the method param a copy is made on the stack which points to the same location to the original object on the heap. Therefore you can change the attributes of the object but the original version (memory reference) is not actually being changed, if that makes sense. Both references are just pointing to the data (values), its these values that are actually getting passed using pointers.
this is a wrong knowledge !!
ОтветитьaP = new Particle ( x, y ); would be a good addition to this review showing the pass by value nature of Java
ОтветитьMade good points, but next time be prepapred. Making shit up as you go is pure laziness.
ОтветитьPass by value (using primitives) you make a copy, and that is what gets messed with, without affecting the original.
Pass by ref(using objects) you are messing with the object itself because it isn't being copied.
You could use a copy constructor to make a "clone" of an object and mess with that one while preserving the original.
Best video to clearly differentiate between PbV & PbR. Great work!
ОтветитьThank you
ОтветитьThank you so much, bearded Harry Potter 😃❤
ОтветитьYour a great teacher ever. Thank you so much for your efforts. 🏆🏆🏆🏆🏆
ОтветитьThis is indeed one of the most clear and helpful tutorials that explain the difference between pass by value and pass by reference. Well done!
ОтветитьFinally, understood the difference between passing by value and passing by reference. Great content.
ОтветитьOh my god. you explain so well
Ответитьthank you so freaking much
ОтветитьI feel like understanding value and reference types are fundamental to a programmer's understanding of async and multithreaded code. I find that programmers are often told not to use pass by reference without being explained it's to safely avoid bad habits in the future when passing by reference could lead to race conditions and non-threadsafe code.
ОтветитьThis is The Professor!
ОтветитьDon't listen to this guy
ОтветитьHeyy youuuu i just wanna thanks to you 🥺 my Mind is going to brust bcz of this concept but not after this video🌻
ОтветитьThank you 3 years and you did not fix it yet. You are making it frustrating to people who want to learn more.! Such a thoughtful person.
ОтветитьThank you so much
Ответитьomg!! amazing it was..
ОтветитьCan't seem to find anywhere what "change()" does.. Can someone help?
ОтветитьHis smiling nature is enough to understand things
ОтветитьPass by value is so annoying! Pass by reference is so much more intuitive
ОтветитьThis video should be updated.
ОтветитьCan we use &p instead of ap?
ОтветитьThank you nong!!
Ответитьint x=10;
int y;
y=x;
print x;
----------------
x=10
pass by ref.
ty <3
ОтветитьHallo is There a site were i van download these sketches?
ОтветитьaP will point to P and not to underlying value so far i know
ОтветитьThis guy looks like the professor from Money Heist
ОтветитьWTF why did everyone knew java as both pass by reference and pass by value earlier and later in life realized that its always pass by value !! :D
ОтветитьCan someone help me with thus please
A method that takes an array of double. Return whether or not every element in the array appears in ascending order, begining with the SECOND element AND if the first element is equal to the sum of all elements beginning with the second element. You must use 1 loop at the most for this and recall the difficulty of checking equality with doubles that may contain math error.
you look like you planning to rob a bank. bank of spain, perhaps? kiddin, thank u for this
ОтветитьIf he bit changed, He will look like Professor from Money Heist
Ответитьthere's no pointers concept in java?
ОтветитьYou are an amazing teacher!
ОтветитьLol make sense... after watching it again ... after 1 year
ОтветитьWorst explanation ever
ОтветитьThis is a tricky concept when you are learning programming languages like c ,etc,3 pages of gibberish text from the book solve ,hope you tube was there back in the 90's learning programming could be fun...thanks master!!!!
ОтветитьThank you
ОтветитьThank you
ОтветитьWhen I play around with this concept it doesn't seem to apply to String or BigInteger...could someone explain why?
ОтветитьFantastic explanation, thank you!
ОтветитьaP → uP 😎👍
Ответитьsay what?
ОтветитьThis video has been very usefull for me thanks u man !
Ответить