• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

KB page no 526

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Please explain me the following table i am not able to understand it

Remember that the equals(), hashCode(), and toString() methods are
all public. The following would not be a valid override of the equals() method, although
it might appear to be if you don�t look closely enough during the exam:
class Foo { boolean equals(Object o) { } }
And watch out for the argument types as well. The following method is an
overload, but not an override of the equals() method:
class Boo { public boolean equals(Boo b) { } }

thanks in advance
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In this "class Foo { boolean equals(Object o) { } }" its not valid because access modifier is more restrict then the Object class equals method

In this "class Boo { public boolean equals(Boo b) { } }" its overloaded because equals method argument list is different compare to Object class equals method.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic