#58 Object Class equals toString hashcode in Java

Поделиться
HTML-код
  • Опубликовано: 6 ноя 2024

Комментарии • 50

  • @nitishkumar-kt1nb
    @nitishkumar-kt1nb 7 месяцев назад +23

    🎯 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

  • @zemariamkiros5133
    @zemariamkiros5133 6 месяцев назад +3

    I swear your are the only channel I see that explains everything perfectly.

  • @shreyamkundu
    @shreyamkundu 3 месяца назад

    Sir your teaching style is too good!! It's very easy to grasp the concepts.

  • @wallshider
    @wallshider 5 месяцев назад +2

    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!!

  • @souvikadhikary2429
    @souvikadhikary2429 Год назад +1

    I saw yoour previous video and after seen this video I got more clearity. Thank you Sir

  • @zakirdeshmukh9916
    @zakirdeshmukh9916 Год назад +4

    very well explained sir and the example of Laptop class is also very good. thanks for providing this for free❤❤

  • @missionimpossible5657
    @missionimpossible5657 27 дней назад

    Thanks so much, I was really struggling. New subscriber unlocked🔓

  • @Sartaj_Ashraf
    @Sartaj_Ashraf Год назад

    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.

  • @SamA-nq4cf
    @SamA-nq4cf 4 месяца назад

    This is old way now we have lombok library it's easyiest way to implement make a video for that.
    Thank you

  • @rimakumari-j8n
    @rimakumari-j8n 5 месяцев назад

    Thank you so much!!. Only because of you I am this able to hold a good package!

  • @Ryu.86
    @Ryu.86 4 месяца назад

    Thank you! I was struggling to do a toString()

  • @jaredwilliams4994
    @jaredwilliams4994 9 месяцев назад

    Greatest Java Tutorial ever!!

  • @merrylia8316
    @merrylia8316 Год назад

    what is hashcode for? why do we use the equals method. like why modify it?

  • @28santagabo
    @28santagabo 4 месяца назад

    great explanation sir

  • @mohammadsulthan9379
    @mohammadsulthan9379 Год назад

    Super sir, i am a big fan of your work.

  • @rishabhagarwal3404
    @rishabhagarwal3404 Год назад +2

    Thank you sir. Amazing video as always

  • @gideonsamuel4963
    @gideonsamuel4963 2 месяца назад

    how can we open the predefined class file (eg: Object.class) in vs code ?

  • @afifkhaja
    @afifkhaja 9 месяцев назад +1

    Awesome video but you didn't really explain the relationship between hashcode and equals

    • @kelvinirungu550
      @kelvinirungu550 7 месяцев назад

      The Object class is the relationship between hashcode and equals because every class in Java implicitly extends the Object class.

  • @robsoonz7766
    @robsoonz7766 Год назад

    Good video. Thank you for understanding this.

  • @halimgiwa5359
    @halimgiwa5359 5 месяцев назад

    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 ?

    • @md.ikramulislam9708
      @md.ikramulislam9708 Месяц назад

      Because we are comparing two objects, so this and that
      In toStrring we are working with only one object.

  • @kavya4132
    @kavya4132 7 месяцев назад

    great explanation. Thank you!

  • @aileenchan3741
    @aileenchan3741 Год назад

    Thank you for that explanation! So easy to follow and understand.

  • @brandonjablasone7544
    @brandonjablasone7544 8 месяцев назад

    What ide you use

  • @oshadhaedirisinghe1455
    @oshadhaedirisinghe1455 6 месяцев назад

    Thank you

  • @bhargav7136
    @bhargav7136 Год назад

    Why we use hash code

  • @ghosts857
    @ghosts857 Год назад

    Hello sir I don't under stand 2 " . " here please explain

  • @milankbudha
    @milankbudha Год назад

    thank u so much....❤❤❤

  • @sharabugnanesh3098
    @sharabugnanesh3098 Год назад +1

    model model 👌

  • @koushikjatoth6000
    @koushikjatoth6000 Год назад

    Can I get tutorial ppt

  • @pankajubhare1699
    @pankajubhare1699 Год назад

    You just awesome

  • @anjelomanoranjan
    @anjelomanoranjan 13 дней назад

    Baba Nam Kevalam!

  • @farhodbekxamidov2013
    @farhodbekxamidov2013 10 месяцев назад

    👍

  • @MrRobo-fi7of
    @MrRobo-fi7of 7 месяцев назад

  • @ghosts857
    @ghosts857 Год назад

    this.model. equal () that please explain

    • @hieuthanh2735
      @hieuthanh2735 10 месяцев назад

      "this" means the current object which calls the method

  • @SurendraGurjar2014
    @SurendraGurjar2014 Год назад +13

    Way of explaining is not good

  • @ChanduR-x8d
    @ChanduR-x8d 8 месяцев назад

    OMG! Do you know at least what you said? This is very sad for beginners

  • @thecrazygamer7334
    @thecrazygamer7334 Год назад

    chomu padhane ka dhnage nahi hai

  • @harshsinghania6775
    @harshsinghania6775 11 месяцев назад

    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..