Тёмный

02. Equals and HashCode Contract & Different Variations 

Ankit Wasankar
Подписаться 8 тыс.
Просмотров 59 тыс.
50% 1

This video includes:
- What is default implementation of equals() and hashCode() method.
- What is equals() and hashCode() contract.
- What will happen if we don't follow the equals() and hashCode() contract.
- Side effects of not overriding hashCode() method when equals() is overridden.
- Interview question based on equals and hashCode implementation.
- equals method always returning false & hashCode method returning same value... then what will happen when we put key-value pairs in hashmap.
#java #interviewquestions #webencyclop
In this playlist I will try to cover all the important java interview questions along with answers in very intuitive, kind of pictorial/animated way.
Complete Playlist:
• Java Developer Intervi...
Next Video:
• 03. Exception Handling...
In this series we will be covering all Java interview questions and answers. This is going to be comprehensive list of Java interview questions which can help experienced Java developers to prepare for an interview as well as upskilling the Java knowledge.
I would always recommend everyone to watch Durga Sir (durgasoft) videos because of extensive in depth explaination on all topics if you have more time.
But here we will try to cover important aspects of Java Programming which are always asked in interviews withing less time.
Interview Questions Answers
java tutorial
learn java
java tutorial for beginners
job interview questions and answers
behavioral interview questions and answers
job interview tips
Interview questions and answers
durgasoft
durga sir
Durgasoft java
hashcode
Equals hashcode
java programming
Java tutorial for beginners
java course
java programming tutorial
java animation
Animated java

Опубликовано:

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 74   
@KiraTeiubesc
@KiraTeiubesc 3 года назад
I have watched like 5 videos on this subject, but it still wasn´t that clear. But you explained everything so clearly and easily that now I get it! Thank you very much 🙏 !
@ankit.wasankar
@ankit.wasankar 3 года назад
Thanks a lot
@rakibullahsarkar1870
@rakibullahsarkar1870 2 года назад
Exactly!
@blinkwit1427
@blinkwit1427 3 года назад
You have a gift for explain clearly concepts. You should continue :)
@AbhishekKumar-pk3zp
@AbhishekKumar-pk3zp 2 года назад
For me, this video has the best explanation of hashcode and equals method contract.👍 Worthy to subscribe.
@mangesh26
@mangesh26 Год назад
You made my day, I watched dozens of videos and gone through many websites, blogs but not able to get clear understanding. But the way you explained it, it blow my mind. Good Job, keep posting videos
@rajatagrawal7016
@rajatagrawal7016 5 месяцев назад
You explained it to me in a very easy manner I have watched many videos but your videos cleared my concepts
@sushiljoshi2326
@sushiljoshi2326 2 года назад
He explained very well with his nicely made presentation ! Thanks for this video. Others make this concept complex, he made it simple .
@rahulrsavant
@rahulrsavant Год назад
Got 10 out of 10 for Explanation, make lots of different videos, using same style, Thanks 🙏
@ericaugusto5640
@ericaugusto5640 3 года назад
Amazing teaching skills, thank you for this, now i finally understand this concepts.
@sourabhgurjar1324
@sourabhgurjar1324 3 года назад
presentation is really good and simple to understand the concept very well.
@ManishKumar-qx1kh
@ManishKumar-qx1kh 3 года назад
we need to make this channel popular by any means. The videos are exceptionally good. Thanks for the hard work brother.
@Reshmashon
@Reshmashon Месяц назад
Really appreciate your effort to make topics so simple and make sure that we understand it.
@ankit.wasankar
@ankit.wasankar 5 дней назад
thanks a lot. your feedback means a lot.
@sapnahegde5491
@sapnahegde5491 Год назад
Thanks. Please upload more videos. You make concepts so clear by your explanation.
@ankit.wasankar
@ankit.wasankar Год назад
thank you, sure uploading more soon.
@sanjayranga2683
@sanjayranga2683 Год назад
The best explanation ever .. i think my interviewer saw your video :P
@pavankalyanmodugu994
@pavankalyanmodugu994 Год назад
The way how u explained awesome great sir make more videos in the same style of explanation &presentation also
@prasadkondhalkar6499
@prasadkondhalkar6499 Год назад
Most simplified explanation watched till now. Great work.
@shivaraju8405
@shivaraju8405 3 года назад
Seriously a wonderful explanation. watched so many videos but after watching this video there is no requirement of watching other videos. Great Work Man, keep it up . tqsm
@shraddhawagh9480
@shraddhawagh9480 2 года назад
Awesome explanation Sir..... when I watched your videos and went for interviews and explained same which you explained , interviewer really impressed with this ... you deserve million of subscribers Sir... one request can you please make video playlist on one real time project so that it would be beneficial for us ... By using latest technologies like SpringBoot , Microservices, latest angular for frontend Database as oracle DB
@hassanmahammad1135
@hassanmahammad1135 2 года назад
Wanted to complete java series, hope u get million subscribers and likes
@dnyaneshtathode5511
@dnyaneshtathode5511 2 года назад
That's a really good explanation. Clear and concise. Keep it up.
@aniruddhachunne3011
@aniruddhachunne3011 2 года назад
Thank you so much sir... you are saver .....i spend whole day to understand this concept..
@karandedhiya9575
@karandedhiya9575 2 года назад
Very simple and to the point explanation with beautiful PPT
@tunghoang9373
@tunghoang9373 3 года назад
Thanks from a user from Viet Nam Your explanation was so easy to understand although it's hard to understand your english as much :)
@prashantranjan4859
@prashantranjan4859 2 года назад
Excellent.. wonderful explanation.. thanks a ton.
@tanishktripathi217
@tanishktripathi217 2 года назад
You earned a subscriber, bro! great explanation, keep doing this!
@iwn77620
@iwn77620 2 года назад
Thank you for the effort of visualising it so good. Very clear presentation!
@aniketjadhav3503
@aniketjadhav3503 9 месяцев назад
this same interview question is asked to me in datamaticas but could not able to answer but now I can!!
@linhpksw
@linhpksw 3 месяца назад
Very clear and through. Thank you so much. Keep doing more!
@naveenprakash3640
@naveenprakash3640 3 года назад
I usually don't comment....but this is really amazing
@supriyashrivastava4535
@supriyashrivastava4535 3 года назад
Explanation is very precise,clean & well documented. Thank you so much sir. Please make a video on java 8 features with implementation.
@ankit.wasankar
@ankit.wasankar 3 года назад
Thanks and sure.
@karthikr8798
@karthikr8798 Год назад
You are a LEGEND sir. Thanks for the video.
@NeverQuitOk
@NeverQuitOk 3 года назад
KINDLY UPLOAD SOME MORE VIDEOS RELATED TO JAVA INTERVIEW QUESTIONS
@smsms8522
@smsms8522 3 года назад
Excellent Video
@priyeshmalviya6483
@priyeshmalviya6483 21 день назад
Thanks bro !! You explained very well about this concept in a video
@ankit.wasankar
@ankit.wasankar 5 дней назад
Glad it was helpful!
@anandlshinde
@anandlshinde 3 года назад
Good Content / presentation and explaination. Keep it up
@savaliyaparth468
@savaliyaparth468 Год назад
Great explanation 👍
@koenasadhu8068
@koenasadhu8068 2 года назад
Wonderful explanation!!
@sreedharreddy472
@sreedharreddy472 6 месяцев назад
well explained sir. It is very clear.
@bharatiyaashish
@bharatiyaashish 3 года назад
The way you explain is wonderful✨ Please make more vdos...🙏👌👏🌻🇮🇳😊🙇
@sirojiddinsaidov3657
@sirojiddinsaidov3657 2 года назад
Very good video. Super
@marvellouschandan
@marvellouschandan Год назад
Awesome explanation bro 😃
@atulverma.515
@atulverma.515 3 года назад
Thanks, Ankit. this is quite a comprehensive video on this topic. A couple of questions came after using the same example. 1. I have created three objects of the student class, st1, st2, st3. with the same values of roll num and name. put s1, s2, s3, and again s1 in the map. but the size of the map is showing as 3 and not 4. however equals always returning false. 2. how come get() method is working, as equals() method in student class is returning false?
@ankit.wasankar
@ankit.wasankar 3 года назад
for first question, from java 8 code, i see java people has added an extra check for object equality viz. if (ref1==ref2 || ref1.equals(ref2) ).. so due to this or condition when same object is added it overwrites.. ( thanks for noticing this. will need to update the same in video) for second question, it's really good question and has been answered on stackoverflow. Please check here. stackoverflow.com/questions/13521184/equals-returns-false-yet-object-is-found-in-map/13521238
@atulverma.515
@atulverma.515 3 года назад
@@ankit.wasankar Thank you Ankit for sparing time to clear my doubt. Cheers.
@rakibullahsarkar1870
@rakibullahsarkar1870 2 года назад
Thank you for clearing my confusion
@parleneha25
@parleneha25 3 года назад
Awsome explanation.. Thank you🙏
@PriyankaC-wo8ns
@PriyankaC-wo8ns Год назад
sir, "==" checks if both the objects are pointing to same memory location or not and .equals() method compares the values.
@ankit.wasankar
@ankit.wasankar Год назад
yes, that is correct, "==" checks if both the references are pointing to same object or not. If equals() method is not overriden, it will use inherited Object.equals() method, which is same as "==" check. If equals() method is override, then it will be behave as per the code in equals() method, and usually equals method is override in such a way that it compares the content/values of object.
@knowledgeispower115
@knowledgeispower115 3 года назад
Great explanation
@nikhilbhangale5894
@nikhilbhangale5894 6 месяцев назад
simply great with animation ......
@jatinsharma3792
@jatinsharma3792 9 месяцев назад
Ahhhh shukariya bhai !!!
@NKG_Creations
@NKG_Creations 3 года назад
Excellent Sir, Thanks alot
@mahmoudramadan9193
@mahmoudramadan9193 8 месяцев назад
Great explanation . thank you ♥
@sandeep_khangar
@sandeep_khangar 2 года назад
Awesome video's and pictorial representation ❤️❤️
@vijayaakkireddy5952
@vijayaakkireddy5952 3 года назад
equals() evaluates to the comparison of values in the objects..If so o1.equlas(o3) should return true right.since == is used for memory reference comparision
@ankit.wasankar
@ankit.wasankar 3 года назад
the default implementation of equals is same as ==
@naveenvigneshwar5190
@naveenvigneshwar5190 Год назад
Thanks a lot 🙏 💓
@RishiChopra141
@RishiChopra141 11 месяцев назад
In Student Class you are not overrriding equals but you are overloading it. To Override equals you have to have same method signature first which is public boolean equals(Object object){...}
@pif5023
@pif5023 8 месяцев назад
I would be careful with the first example, it is confusing. The JVM will say o1.equals(o2) not strictly because they point to the same object in memory but because being the same object their fields will be the same by value. The operator to check for identity (exact same object) is == in Java.
@SinghRahul-
@SinghRahul- 2 года назад
why dont u upload more videos..
@priyamore8582
@priyamore8582 2 года назад
It's just like string. N. When we create with new then instance is thre n alm
@MHK958
@MHK958 Год назад
Awsome
@ankit.wasankar
@ankit.wasankar Год назад
thank you
@davidbilla2361
@davidbilla2361 2 года назад
Why you stopped posting videos?
@karamjitsinghsehdev3451
@karamjitsinghsehdev3451 Год назад
But equals method compares the content and not the memory location. 😢
@ankit.wasankar
@ankit.wasankar Год назад
Yes, the equals() method should always compare the contents. But if you don't override the equals() method in your own class, then it takes the default implementation of the equals() method, and that implementation doesn't compare content instead it compares the memory internally.
@GauravVermasadh_raj
@GauravVermasadh_raj 3 года назад
how get operation will work here ?
@thevagabond85yt
@thevagabond85yt 10 месяцев назад
9:12 this chart is OP
@jeebanpradhan8050
@jeebanpradhan8050 Год назад
Bro logical program java please
Далее
01. Internal Working of HashMap & Java-8 Enhancement
19:11
#58 Object Class equals toString hashcode in Java
12:00
Interview Question | Comparable vs Comparator in Java
12:58
Set and HashSet in Java - Full Tutorial
20:43
Просмотров 223 тыс.
Java - Compare the Objects using equals() & hashCode()
16:16
.equals() vs. == in Java - The Real Difference
8:48
Просмотров 190 тыс.