Perfect explanation for an important topic. Even in some university lectures, the professors can't explain these things like you do. I already knew these things but the way you tell about them is just impressive. Thanks for your efforts. Great work.
Thank you so much for this! I have always said that boxes makes my learning easier, and in this case it was definitely true. I have been struggling to understand how reference types work in Java and this video made me understand it.
please note that non-primitive types do not store their values in stack they only store the reference in the stack and that reference will be connected to a random part inside "heap" , the heap will contain the value of that reference
Thank you very much for the explanation, I wanted to ask you for advice recently I wanted to learn how to create apps with flutter and the language it uses is dart and it's oo like java do you think I should learn java first then dart or it's best learn dart straight away?
I just take the course outline from my class and look for corresponding videos on NESO Academy. My professor knows I don’t show up to class and wonders how I can still pass my exams and hw 😂
public class Program { public static void main(String[] args) { String s1="hello"; String s2=s1; s2="hi"; System.out.println(s1); System.out.println(s2); } }. The output is : hello, hi sir why the output is different as they reference the same String “hello”
Because you reassigned the value of s2. While they were both assigned to the same value, they could point to the same object in memory. But since s2 was reassigned to a different value, it had to point to a different object in memory.
when you instantiate a variable of type string, a string variable or container will be allocated in the memory that stores the reference of the value at the same time the value of the variable will be created in the heap memory.
Thank you sir for the explanation, it was very well done! I have a question but feel free to not answer it. In the reference type example you gave, you give us two variables "s1" and "s2". "s1" references the address location of the object string "hello" that is 1008 right? but in the case of "s2" it references the VALUE of "s1" not the address location of it, so that would make "s2" a primitive type because it references the value instead of the directory no? what if "s2" put in its value the address location of "s1" so that then that can take it to the "s1" value and since now the "s1" value is the string location "hello", the program finally take us to the string location "hello". is that possible?
Both s1 and s2 references to the address location of the value which is 1008. None of them are referencing an actual value. About the second part, Java doesn't behave that way because if you have n Strings then it would take a lot of runtime complexity to get to the actual value, so referencing to the actual value address is just straightforward.
Why is that i1 and i2 have different values as you mentioned in the last part. of video. In my view, they do have different adresses which make i1 and i2 are different. But they do have same value, because i2 is assigned value 5 from i1.
This was the best explanation of Reference types I've ever watched. This was awesome. Thank you
You are the greatest teacher ( who teach us free on CZcams ) ,ever in the youtube , for teaching java . 😍
Crisp, clear, to the point!!
Hats off Neso Academy for making learning so efficient!
Perfect explanation for an important topic. Even in some university lectures, the professors can't explain these things like you do. I already knew these things but the way you tell about them is just impressive. Thanks for your efforts. Great work.
At the end of every video u say Thanks for watching 😊 but I have to say Thank you 😊 for making this tutorial...
Really Helpful 🙏
Have been struggling with the idea of reference variable and this amazing videos clear my doubts!!!
This made things so much clear. Thank You!
This is really best lecture on primitive and reference types.Nobody can explain like this.Thankyou sir for this amazing series🔥🔥🔥🔥🔥😊
Really great explanation and was very clear and on point. Thank You :)
What a clear explanation!! You saved my time!! I appreciate it
Thank you so much for this! I have always said that boxes makes my learning easier, and in this case it was definitely true. I have been struggling to understand how reference types work in Java and this video made me understand it.
THANK YOU SO MUCH DEAR Lecturer for this good explanation and easy to understand videos. you are a genious. bless
Energetic explanation that helps to understand the concept
You are a life saver man. Big ups!
Amazingly done! Hats off
gj man. Why cant university teachers explain it like this
Fantastic video, thank you!
Thanks for making such conceptual videos.
please note that non-primitive types do not store their values in stack they only store the reference in the stack and that reference will be connected to a random part inside "heap" , the heap will contain the value of that reference
The reference address is stored in the stack(which contains the address/pointer) and its contents in the heap?
@@farzin818 yes
Nicely expained. Thank you so much
Great Explaination.
Thank You.
Nice explanation
Thanks for this informative videos!
Best explanation !!! Thank You
Great explanation!
thank u so much! i was struggling to understand the difference but u explained it really well
This was great. Thank you.
you are explaining with Abbreviated and awesome way 👍👏
This is an amazing explanation!
Thanks for the explanation... ✨
thank you soo much its so well explained good continuation
Excellent explanation!!
Great explanation. keep it up!
I watch so many videos and you are the best , I really understood the topic
My teacher is refering this vid and presenting it, Thank You!
nice concept u share;
You're amazing teacher. I watched few movies on CZcams and I don't understood nothing. Thanks!!!.
This was the best explanation. I like it.
The best explanation ever.
Excellent class as usual
Very clear, thank you my friend)
The best explanation ever....
Thank you so much you explained it so easily
very good explaination!
The best explanation ever
U r the world's best teacher sir😍😍
really good! thank you!!!
A great explanation....
Best explanation,I am very clear about this now tq so much sir
very simple and objective
great explination
Thank you!
thank you so much !
amazing video!!!
Very good job
I love you Neso Academy. ❤️
yes yes thank! for your video help in me to understand my teacher lesion.
thank you so much
Great video
Excellent
Sir, can't wait to witness the neso aap !!!how much more will I have to wait???
thank u so much bro
Perfect!!
thank you sir
Thanks
primitive should me named ---> expresion type. amd all would be clear and understable :) Thank you man ! this was very good explaination
Bahut sahi sir ❤️🔥
🙌wonderful
Thankyou
Awesome. But we are waiting for reamainder video in c programming and data structure series. Please sir make reamainder video as soon as possible.
thank you thank you thank you THANK YOU !
Thank u
great!!!
the best explanation
Hello friend, is it possible for us to study together because I am not good at Java and cannot study on my own. Can we cooperate together?
Love it
Great explanation. One question, why is important to know memory location etc..theory what is Refrence types vs Primitive types?
super
thanks man,finaly i catch it ❤
Hello friend, is it possible for us to study together because I am not good at Java and cannot study on my own. Can we cooperate together?
ونصيحه وانتي بتشوفي الدبلومه حلي problem solving في موقع hackerrank بالتوازي مع الدبلومه
شكرا كثير
thankyo for clear explanation my teacher and i appreciate you millions times
THANKS ALOTTTTTT
Thank u very very much ......I'm suffering from this confusion for 1 month.
Hello friend, is it possible for us to study together because I am not good at Java and cannot study on my own. Can we cooperate together?
@@user-ml9oi5rh9x ok
@@bringmygroozaaop5864 fatima_khaleel001 my insta
Thank you very much for the explanation, I wanted to ask you for advice recently I wanted to learn how to create apps with flutter and the language it uses is dart and it's oo like java do you think I should learn java first then dart or it's best learn dart straight away?
If you just want to build apps I’d use dart, most oop languages carry the same logic with different syntax
The accent made it even more intresting.
I just take the course outline from my class and look for corresponding videos on NESO Academy. My professor knows I don’t show up to class and wonders how I can still pass my exams and hw 😂
the best...
public class Program
{
public static void main(String[] args) {
String s1="hello";
String s2=s1;
s2="hi";
System.out.println(s1);
System.out.println(s2);
}
}. The output is : hello, hi sir why the output is different as they reference the same String “hello”
Because you reassigned the value of s2. While they were both assigned to the same value, they could point to the same object in memory. But since s2 was reassigned to a different value, it had to point to a different object in memory.
Sir why reference type directly not store a value instead of storing a address of the value?? Pls clear my doubt?
legend
How to make reference variable of int?????
habibi tum nice explain karti
Hmm 🤔 interesting
5:30 How "hello" is getting stored in the memory without declaring a variable or a container?
when you instantiate a variable of type string, a string variable or container will be allocated in the memory that stores the reference of the value at the same time the value of the variable will be created in the heap memory.
Thank you sir for the explanation, it was very well done! I have a question but feel free to not answer it.
In the reference type example you gave, you give us two variables "s1" and "s2". "s1" references the address location of the object string "hello" that is 1008 right? but in the case of "s2" it references the VALUE of "s1" not the address location of it, so that would make "s2" a primitive type because it references the value instead of the directory no?
what if "s2" put in its value the address location of "s1" so that then that can take it to the "s1" value and since now the "s1" value is the string location "hello", the program finally take us to the string location "hello". is that possible?
Both s1 and s2 references to the address location of the value which is 1008. None of them are referencing an actual value. About the second part, Java doesn't behave that way because if you have n Strings then it would take a lot of runtime complexity to get to the actual value, so referencing to the actual value address is just straightforward.
💥💥💥💫
I want a playlist on advanced data structures
through c++
Sir How to get a variables memory address, can you give me code to it
Thank You, Radha Radha
Sir ye wala nhi smjh aaya aur sb aa gya
Why is that i1 and i2 have different values as you mentioned in the last part. of video. In my view, they do have different adresses which make i1 and i2 are different. But they do have same value, because i2 is assigned value 5 from i1.
as they both stored in different addresses makes the values different.
like like 👍🏻👍🏼