Java Reference
In-Depth Information
Useful Methods of the Object Class
Method
Description
Creates and returns a copy of the object (not a public
method)
clone()
Indicates whether the other object is equal to this one
equals(obj)
Called automatically by Java when objects are
destroyed (not a public method)
finalize()
Returns information about the type of the object
getClass()
Returns a number associated with the object; used
with certain data structures
hashCode()
Returns the state of the object as a String
toString()
Advanced methods for multithreaded programming
notify(), notifyAll(), wait()
Useful Methods of Point Objects
Method
Description
Returns the distance from this Point to p2
distance(p2)
Sets the coordinates to the given values
setLocation(x, y)
Translates the coordinates by the given amounts
translate(dx, dy)
Useful Methods of Random Objects
Method
Description
random logical value of true or false
nextBoolean()
random real number between 0.0 (inclusive) and 1.0 (exclusive)
nextDouble()
random integer between -2 31 and (2 31 - 1)
nextInt()
random integer between 0 and (max - 1)
nextInt(max)
 
 
Search WWH ::




Custom Search