Overriding equals and hashCode in Java - 039

preview_player
Показать описание
How can I tell if two Java instances represent the same instance? And what does class equality mean in Java?

The question here is, what does it mean to be the same or different in Java. If you modeled me, maybe two of me had blue shirts and the third had a red shirt. So their shirt color attribute would be the blue for two DJ instances, and red for a third DJ instance. Are they equal because they have the same color shirt, or are they the same me? We're going to clear that up in this lesson as we learn about what it means in Java for two instances to be equal.

#java #programming #tutorial





Full transcript:

Concepts: Java, classes, equals, hashcode

Social Links: Don't hesitate to contact me if you have any further questions.

Hosted by DJ Spiess

Related Videos:

What are static factory methods in Java? - 036

Free Java Course Online

Media credits: All images are owned by DJ Spiess unless listed below:

Music

Рекомендации по теме
Комментарии
Автор

"Equality is something that should be easy but has many nuances."
-DJ 2015

Wisdom for the ages...

jonesmm
Автор

finally someone who explains this. Every video i see just explains the basics

ngndnd
Автор

Thank you for the speed and clarity of the explanations. Great video!

Allalilacias
Автор

Incredibly helpful, with very straightforward explanations!

Zydico
Автор

Nice visuals and editing, and more importantly good and concise teaching too. Thank you so much for sharing.

catzrulez
Автор

Really nice way. I wasted two hours to understand this. Finally got it. Thanks Deege U

sanjup
Автор

Your approach to teach stuff is unique, Thanks for this video!

rihipat
Автор

Best explanation I've seen. Cheers

Michael
Автор

This video saved my grades. Thank you!

jennab
Автор

Thank you so much, great video would recommend that when talking about the overriding you noted when as many for the attributes, would be helpful if you're example included multiple to see how it would be extended. Either way, great video!

proalexv
Автор

I just discovered your videos and I love them pleaase keep doing them It helps a lot! gratings from Argentina!

delucabruno
Автор

The equal equal sign checks for value in the memory address of two objects not their fields that’s why we should override equals and hashcode. True or not?

simplet
Автор

Hi, 5:22 you showed us a chart for creating overriden hashCode() method . Is it conventional / necessary to use that chart ?(Is it Oracle specific)

Utshaw
Автор

Just found this channel...great job thanx :)

zombiezombie
Автор

Thank you for explaining something in 6 Minutes while my Professor needs 2 hours to overcomplicate this topic.

Buuhuuda
Автор

Hey thanks for making this topic so fun to understand! Thumbs up!

Triviorito
Автор

Great video! But where did you get the hash chart formula? Is it available somewhere in java documentation?

aneukmie
Автор

Very good explanation and funny as well. Good Job!

JD-kxoe
Автор

wow this was a great explanation! thanks a lot for this video

terran
Автор

Thanks Deege U, the way of teaching is very good and effective. :)

yogeshadsare