aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes java.lang.object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "java.lang.object" Watch "java.lang.object" New topic
Author

java.lang.object

Kota li
Greenhorn

Joined: Sep 05, 2007
Posts: 20
which of the following classes java.lang.Object override hashCode() method in Object class
java.lang.String
,, ,, .StringBuffer
.Number
.Byte
which of them override
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14139
    
  18

You can find the answer by looking up the API documentation of those classes. If the documentation doesn't mention a hashCode() method, then the class doesn't override it.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Vikrant Sahdev
Ranch Hand

Joined: May 31, 2007
Posts: 58
String and Wrapper classes override equals() method. And by contract, if you override equals() method, you need to override hashCode()method as well.

StringBuffer doesnt override equal()method and therefore doesnt override hashCode()method as well.


Coming soon... www.javatales.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.object