so far I've watched several videos with the same topic but this video only explained well. Thanks man!
@CodingWithJohn3 жыл бұрын
Awesome! Very glad I was able to help!
@phillipmiller46427 ай бұрын
Agreed
@Dare242 жыл бұрын
Oh my god I'm genuinely so thankful I discovered this Channel, John explains stuff like no one else does, you just earned yourself a subscriber mate, thank you for all the efforts.❤
@magicalhats3 жыл бұрын
I'm a newbie dev and I finished a bootcamp but your videos topics are all the topics I found confusing during class and always wondered about. TY so much.
@alexanderpanday8 ай бұрын
go away bootcamp people
@cjm1012 жыл бұрын
Feeling lucky to have found this channel, I've been self studying on and off for a couple years and I'm pretty sure I should have known these key concepts by now, sincere thanks for these clear and understandable teachings!
@aureliasam20922 жыл бұрын
Hi John you did very well in this lesson. I tried to learn .equals and == from a professor but I couldn't understand it and now I got the point from you in 5 minutes.
@iruga73792 жыл бұрын
OMFG please keep your content comming...im having a blast learning from you man. Im deeply grateful for all your lessons.
@dotanon2 жыл бұрын
I got back into Java recently after not using it for like 8 years and have been haphazardly using == for strings and it has been working, presumably because I have been always using strings as state variables in games, and so have been manually typing the strings in my conditions as literals (if (facing == "up")) etc. I saw a comment on another video and I'm glad I found this early enough to refactor everything. haha.
@streamity242 жыл бұрын
Really fascinated at how good you are able to explain. Thanks for the great video!
@theFUNkaarasChannel2 жыл бұрын
I just found your channel and the world just makes so much more sense now.
@Visionist3 жыл бұрын
Simple and easy to understand. Thank you!
@brtkgromek3 жыл бұрын
I'm glad I've found this chanel. I've never been more educated by any other escaped convict in my entire life! Keep it up! :)
@enigma64633 жыл бұрын
😂😂
@terrypark3690 Жыл бұрын
wow this goes well with your string pool video. Thanks for making these really comprehensive videos on how java works for the basic things we just usually use without thinking about.
@AhmedMo0Ali10 күн бұрын
what is iconic about Sir.John that he knows exactly how beginners feel or understand or even react with every single information he say Despite he is a high level engineer and sees every thing clear.
@olivierbegassat851 Жыл бұрын
These are beautiful videos man 😁 Every sentence of yours resolves an issue I had and leads to the next question I had. So helpful ! Thanks 🙂
@harlockgaming1476 Жыл бұрын
Love the Kramer picture in the back, my grandpa has one just like it! Thanks for the amazing videos!
@tonnytrumpet7347 ай бұрын
Sir I have been watching your videos for around 30 hours last 3 days, thank you so much this is great content I am starting to actually understand Java and see how things from different videos relate to each other, sometimes I can guess what you are going into with your train of thoughts, very well put together videos.
@ovey22143 жыл бұрын
That was incredibly well explained! Thanks a lot!
@manojpal44152 жыл бұрын
Had been scratching my head on a case similar to the example at last, luckily this video explained it. Huge thanks :)
@Fawstah2 жыл бұрын
This actually helped me understand why some of the code I was writing was initially breaking. Ty!
@cananozdemir891311 ай бұрын
I just bought his full Java course. Amazing explanation .
@BelayeAssefa13 жыл бұрын
this channel always dropping gems. Respect.
@WildNature1702 жыл бұрын
Ah Lord! can't just say how easy you explained it. I have been really confused for several days about this simple .equals in object class and now I know how java processes it. Thank you so much for this video. Subscribed liked and commented. Keep up with your good work!!!!
@danieldanian80702 жыл бұрын
This guy is the best as a learner and teacher guide
@micahrufsvold3 жыл бұрын
Small piece of feedback: title shoulda been ".equals() and == are not equal" Thanks for the great video!
@CodingWithJohn3 жыл бұрын
.equals() != ==
@micahrufsvold3 жыл бұрын
@@CodingWithJohn even better!
@the_Spartan_117 Жыл бұрын
By the beard of Zeus! Your contributions to the world of programming are nothing short of epic. Your Java beginner's playlist is truly a stroke of genius, and I speak for many when I say, you are the real MVP!
@jesusromero712 жыл бұрын
tus videos tienen un gran valor, muchas gracias por compartir tu conocimiento
@LTZMSYAL2 жыл бұрын
Thansk's John. Please don't stop your videos they are awesome
@DatCrossGuy2 жыл бұрын
Thanks so much for the video. Genuinely looking forward to the "how to write a good equals method" vid!
@dhavewala3 жыл бұрын
John, this was an amazing tutorial! I had a query though; on the objects, do we override the equals() or is it inferred?
@wiktorstankiewicz35683 жыл бұрын
we override it
@fullfungo3 жыл бұрын
6:15
@michael_scarn_ Жыл бұрын
Thanks John, your tutorials are very helpful. You are a great teacher, hats off!
@pawehericht26737 ай бұрын
at 1:46 it is worth saying, that String one = "1"; String oneBis = "1"; when comparing one == oneBis will output true? what has changed and why String one = new String("1) gives us false when ==? The answer is: The String pool I believe
@ruzi173 Жыл бұрын
This is just the best explanation..wow👏Thank you for all your videos🙏
@enfieldli92962 жыл бұрын
Wow, noob here, didnt know those details till you explain it, massive thanks John!
@technicalboy18163 жыл бұрын
I wish you were my lecturer at Uni. You have talent man!
@praveens9233 Жыл бұрын
Warning ⚠️ : If you are going to override .equals method,you have to override your hascode method. Otherwise there will be a mess with those objects whenever you hashing
@ujjwals.dadwal89112 жыл бұрын
Thanks John, Mucha Gracias from Canada!
@amaralensheriff Жыл бұрын
Thanks John, your tutorials are awesome.
@xrecovery923 күн бұрын
Thank you so much! You solved a bunch of hurdles I was facing while coding in Java. You earned a new Subscriber! By the way, what program are you using to code?
@cryptoInNutshellR Жыл бұрын
Thanks. Useful, however you still did not cover how to compare 2 objects on the Dog example staring from 05:08
@Eduardado2 жыл бұрын
Very clear. Awesome examples and also my eyes love the dark theme ^^
@akna198710 ай бұрын
These videos are great! But you should have included a video on how to implement the .equals-method and compare-to method to your own class
@YusufDemir-gx7he2 жыл бұрын
It seems I've found my coding channel. Thanks for the video :)
@rahul644103 жыл бұрын
Thanks for the video john seems like refreshing my basics
@shubhamkatwale67163 жыл бұрын
Very well explained Jonh, Thanks again ♥
@HR-pz7ts Жыл бұрын
Once you learn a thing or two about oops you know exactly what's going on. Thank you for the video
@98912544082 жыл бұрын
This is the best i have understoon so far...
@lamaspacos10 ай бұрын
This channel is very very good.
@wayneinteressierts9973 Жыл бұрын
Great video as always. Thank you for your dedication!
@eshwarnag Жыл бұрын
the last part was really good!
@brunomartel4639 Жыл бұрын
is it too bad if we declare Strings as literal all the time? like String string1= "hello" instead a declaring an object with it? I mean is there a reason to declare an object String?.
@robertod893 Жыл бұрын
Excellent video as always!
@scottcarter45262 жыл бұрын
Might also be worth mentioning that you can use == with enum's as well.
@binilgeorge73583 жыл бұрын
But in your strings are immutable video, you said when initializing a string variable java points it to a pre existing string memory address. With that, here hello is already exist when you initialize the second string. Therefore both variable should point to same address, that is using == returns true. ? I am confused plz answer me.
@lumschente3 жыл бұрын
the string itself is probably wrapped in a class and the class stores the reference to the string pool but the objects are initialized in different memory regions
@binilgeorge73583 жыл бұрын
@@lumschente Don't know if it is true, but that makes sense
@shravanbandari2 жыл бұрын
I was thinking about the same, @john could you please clarify this question Here is the other video of your we were referring to 🙂 kzbin.info/www/bejne/eJucfquVgd1mp5Y
@konstantinzakharov5643 Жыл бұрын
I love this guy! I am hitting the Like button!
@nilou-bt2 жыл бұрын
You explained sth in 8minutes that my French prof couldn’t explain in 2 hours and made me hate Java for no reason . Thank you ❤
@علیحمیدی-س2ر Жыл бұрын
Thx for your clear presentation Sir
@colonelh.s.l.38342 жыл бұрын
This is awesome! Can you do a video on priority queues and comparators, and how they come together?
@InfiniteWisdom1.0 Жыл бұрын
Thank you so much, your videos are pretty helpful 😊
@shama-_-2 жыл бұрын
thanks a lot you help me to understand the concepts
@bhagyakavijan90142 жыл бұрын
Thank you so much.. Your explanation is very clear...!!!
@simonjunior1843 жыл бұрын
Amazing explanation. My Uni java lecturer even didn't taught us this important concept. Keep up the great job!
@laurentlefevre92332 жыл бұрын
Nice job John !
@saranr48782 жыл бұрын
Just the greatest explanation !
@Amy-zb4iq2 жыл бұрын
What’s the codes for .equals() in class Dog?
@iyhan19873 жыл бұрын
7:03 I guess almost everyone(who studies Java seriously) knows about the pool of strings cause it is a pretty common topic. I bet if you want really “to impress some nerds” you should show them some “pool of Integer” style tricks :)
@MasonJF2 жыл бұрын
See this is interesting, because I thought with Javas memory management scheme that it uses and forces strings to be immutable would reference the same object in memory, even though the variables are two seperate ones. Eg. I was under the impression that String string1 = "James"; String string2 = "James"; these would both point to the same object in memory because these are the same value, which you would think would cause the == operator to go "Oh hey, this is true!".
@viv75313 жыл бұрын
Hello John, after You Ctrl + click on .equals (4:15 min) how did you go back? I mean how to hide all that info that appeared after Ctrl + clicking?
@matteoZattera2 жыл бұрын
It just opens the file where .equals is defined, just close this file
@SecretFols Жыл бұрын
The underline is even if the primitive or non primitive or user defined type java will check for the memory location and not the values.. (if the values are same then uses same memory location).
@strigidae89393 жыл бұрын
Love your videos bro. Very helpful. Thanks a lot
@ayanokoji84562 жыл бұрын
Wow thanks man it is so well explain !
@GenjaOrigins3 жыл бұрын
You are great. Congrats for channel and being Team Leader. Maybe you could/should make a video talking about what should a junior know. I think i know equals now, exceptions/throw/finally/catch etc, im learning generics and i undertand but i saw a generic method in an interview(company was about HR, and i was asked 4 Design Patterns which i knew but wasnt good enough for company anyway) i had no idea what it was even if i knew generics it was kind of pro code/ultra weird and hard i think it was with lists btw..i also hate leetcode i prefer videos like yours to actually learn java. I would also learn more from you cause you good and you enjoyable i hope you do the same in your job irl. i think i also know most of collections hashmap/set etc
@galirams96538 ай бұрын
John, please clarify this for me, in text, how would you declare and compare 2 string objects for equality?
@thalathotitharunprabhakar33903 жыл бұрын
Easy to understand. Thank you.
@bhukyasharath2015 Жыл бұрын
Superb sir❤
@adamlasry52252 жыл бұрын
Great lessons as usual. Thanks.
@LAZIO14 Жыл бұрын
Thanks! Your videos are great!
@danielcommins12853 жыл бұрын
John, where did you get the source and how did you attach the source to the binaries? UPDATE: solution is to point your JRE path to the path with the JDK instead!
@alyankhan8062 жыл бұрын
The API contract also states that if you override equals() then you must override the hashcode(), it's an important detail!
@Sui-Zan3 жыл бұрын
Orange is the new black, John. You look great! Thank you very much for the videos. You make java seem so simple to me.
@altamashsabri81422 жыл бұрын
Amazing explanation, thanks alot
@Coccoutube2 жыл бұрын
Thanks John!
@GaryChike3 жыл бұрын
This is a gotcha for those coming from C#. Great explanation John!
@surkesden3 жыл бұрын
Good explanation! What about enum comparation? What should I use?
@iamnotfamous65919 ай бұрын
but in one video you said that java make different variables but when we store same values to it java make them point to the same locations where the value is stored!!! why??
@cestmoi52482 жыл бұрын
wow, very well explained. Thank you
@Zalaniar2 жыл бұрын
I was gonna say something about the weird use of a string constructor at the beginning, but it's a good thing I decided to wait, lol. IIRC, the javadoc even yells at people about wanting to use == for strings which I find hilarious.
@AHMED-ry2gy3 жыл бұрын
dude, your videos are amazing
@pankajthorat46063 жыл бұрын
I am going through you video and its very easy to understand . One more request can you please provide session for Stack vs heap memory.
@Programming-for-all-u2l2 жыл бұрын
Excellent teacher
@dylangovender2 жыл бұрын
Amazing tutorial!
@InfoBuzz11302 жыл бұрын
Hey pls make video on comparable comparator interface in java
@DanielOliveira-ru7mt2 жыл бұрын
Thanks Johnny Sins
@lyrixvibz7 ай бұрын
Please be polite with your words👍
@1blkvinci6 ай бұрын
@@lyrixvibzhe said thank you
@lyrixvibz6 ай бұрын
@@1blkvincido you know Johnny sins?💀
@SifatUllah-125 ай бұрын
@@1blkvinciThat's not the right way to say thank you.
@HIMANSHURAGHAV-km8rr5 ай бұрын
Thanks john 😄
@amruthashekar35446 ай бұрын
Hello John, please answer why i am getting false in first case? String str1 = new String("hello"); String str2 = new String("hello"); System.out.println(str1.equals(str2)); and String str = new String("java"); String rev = new String("avaj"); System.out.println(str.equals(rev)); how string comparision is done, is it character by character?
@SupunWithana-t8x5 ай бұрын
I think better you recheck 1st case, it has to be true
@aymengouja38952 жыл бұрын
thanks a lot !!! awesome explanation
@potatofypotatofy77722 жыл бұрын
Thank you John
@stacywen79082 жыл бұрын
thank you so much! very helpful!
@hba60183 жыл бұрын
String Pool, the place where are inline strings are saved, that's why you use new String("hello")
@JPS13Laptop3 жыл бұрын
As a python programmer, I definitely see myself getting confused if I were to ever get into Java. Thanks for the explanation :)
@tazogochitashvili65143 жыл бұрын
You shouldn't look too deep into the difference between "is" and "=" in python then lol
@JPS13Laptop3 жыл бұрын
@@tazogochitashvili6514 I actually do realise the difference between the two. But I don't use 'is' in my own code tbh. Also it annoys me that Java uses == for object comparison whereas Python uses it for value comparison.
@palmolive45413 жыл бұрын
@@JPS13Laptop Java doesn’t use == for object comparison, that was the whole point of this video
@JPS13Laptop3 жыл бұрын
@@palmolive4541 It appears that I still don't fully grasp what an object is. Also it seems that `is` in Python is what `==` does in Java, which is still annoying tbh.
@tazogochitashvili65143 жыл бұрын
@@JPS13Laptop that means that you don't understand either "is" in python or "==" in Java