This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Object class subtleties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Object class subtleties" Watch "Object class subtleties" New topic
Author

Object class subtleties

chetan nain
Ranch Hand

Joined: Jun 21, 2000
Posts: 159
1. equals() is overridden by :Boolean , Character , Integer , Long , Float , Double ,
String , and Bitset classes. it is NOT overridden by StringBuffer.Application of
equals() to classes not overriding it will yield same result as ==.
2.The equals method defined by class Object for any reference values x and y, returns true if and only if x and y refer to the same object.
Overridden by Boolean, Character, Integer,Long, Float,Double,
String, and Bitset.

3.The general contract of hashCode is as follows:
Whenever it is invoked on the same object more than once during an execution of a Java application, hashCode will return the same value.
If two objects are equal according to the equals method , then calling the hashCode method on each of the will produce same result
Copying an object by clone() method will typically entail creating a new instance of its class, but it also may require copying of internal data structures as well.
4. There is no public constructor for the class Class. The Java Virtual Machine automatically constructs Class objects as
classes are loaded; such objects cannot be created by user programs.
5. public static void gc()
Calling this method SUGGESTS that the JVM expend effort toward recycling discarded objects. in context of certification exam, we can only SUGGEST, not FORCE garbage collection.
any more suggestions?
 
jQuery in Action, 2nd edition
 
subject: Object class subtleties
 
Similar Threads
overiding hashCode method from Object Class
equals method
Equals( ) method semantics
Reg == and equals
Use Case where hashCode() is required & not equals()