🎯 Key Takeaways for quick navigation: Every class in Java implicitly extends the Object class. The Object class provides methods like equals, hashCode, toString, etc., even if not explicitly defined in a class. The toString method returns a string representation of the object, including the class name and hash code. The hashCode method generates a unique identifier for objects based on their values. Using equals method from the Object class compares objects based on their memory addresses, but custom equals method can compare based on values. Implementing custom equals and hashCode methods ensures proper comparison and adherence to Java best practices. IDEs can automatically generate equals and hashCode methods based on selected variables, simplifying implementation. Understanding and utilizing methods from the Object class such as toString and equals is essential in Java programming. Made with HARPA AI
Christ almighty.. I've been pulling my hair trying to understand chatgpt to explain to me why I need hashcode in operator == overriding and here you go, explaining everything! Thank you!!
In the first == it should return false they are two different objects with two different locations.. So equall methods returns true if the reference are same means they lie on the same location.
🎯 Key Takeaways for quick navigation:
Every class in Java implicitly extends the Object class.
The Object class provides methods like equals, hashCode, toString, etc., even if not explicitly defined in a class.
The toString method returns a string representation of the object, including the class name and hash code.
The hashCode method generates a unique identifier for objects based on their values.
Using equals method from the Object class compares objects based on their memory addresses, but custom equals method can compare based on values.
Implementing custom equals and hashCode methods ensures proper comparison and adherence to Java best practices.
IDEs can automatically generate equals and hashCode methods based on selected variables, simplifying implementation.
Understanding and utilizing methods from the Object class such as toString and equals is essential in Java programming.
Made with HARPA AI
Thanks buddy ❤
I swear your are the only channel I see that explains everything perfectly.
Sir your teaching style is too good!! It's very easy to grasp the concepts.
Christ almighty.. I've been pulling my hair trying to understand chatgpt to explain to me why I need hashcode in operator == overriding and here you go, explaining everything! Thank you!!
I saw yoour previous video and after seen this video I got more clearity. Thank you Sir
very well explained sir and the example of Laptop class is also very good. thanks for providing this for free❤❤
Thanks so much, I was really struggling. New subscriber unlocked🔓
In the first == it should return false they are two different objects with two different locations.. So equall methods returns true if the reference are same means they lie on the same location.
This is old way now we have lombok library it's easyiest way to implement make a video for that.
Thank you
Thank you so much!!. Only because of you I am this able to hold a good package!
Thank you! I was struggling to do a toString()
Greatest Java Tutorial ever!!
what is hashcode for? why do we use the equals method. like why modify it?
great explanation sir
Super sir, i am a big fan of your work.
Thank you sir. Amazing video as always
how can we open the predefined class file (eg: Object.class) in vs code ?
Awesome video but you didn't really explain the relationship between hashcode and equals
The Object class is the relationship between hashcode and equals because every class in Java implicitly extends the Object class.
Good video. Thank you for understanding this.
In the toString() method, we simply used "model" and "price" but in the equals() method we had to use "this.model" and "this.price," why ?
Because we are comparing two objects, so this and that
In toStrring we are working with only one object.
great explanation. Thank you!
Thank you for that explanation! So easy to follow and understand.
What ide you use
VS code
Thank you
Why we use hash code
Hello sir I don't under stand 2 " . " here please explain
thank u so much....❤❤❤
model model 👌
Can I get tutorial ppt
You just awesome
Baba Nam Kevalam!
👍
❤
this.model. equal () that please explain
"this" means the current object which calls the method
Way of explaining is not good
Why
Just this one only
If you want to understand more, you have to watch the previous video @@Psuedobot
Right😢
😂 acha mazaq hai
OMG! Do you know at least what you said? This is very sad for beginners
chomu padhane ka dhnage nahi hai
bhai apne channel ki link send krdo tb
I came to learn the generated code... But here you generated and skipped the actual use of each and every line in the code... Disappointed alien..