Free Guides

Language Tutorials

                            

SUN

Your Ad Here

 
               SUN CERTIFIED JAVA PROGRAMMER FOR JAVA2 PLATFORM 1.4

       Index     

Fundamental Classes

  • The Math class is final and all methods defined in the Math class are static. This means you cannot inherit from the Math class and override the methods. Also, the Math class has a private constructor so you cannot instantiate it.

  • ceil(), floor() and random() return double values. round() returns a long for double inputs and int for float inputs. Trigonometric methods take radians as arguments, so we use Math.toRadians().

  • All wrapper classes except Character have two constructors – one that takes the primitive value and another that takes the String representation of the value. Character takes char type as argument.

  • Wrapper objects are immutable.

  • All wrapper classes (except Character ) define a static method valueOf() which returns the wrapper object corresponding to the primitive value represented by the String argument. Then byteValue(), doubleValue(), floatValue(), intValue(), longValue(), shortValue()are used to get the primitive values from the wrapper classes.

  • Parser methods may be used to short-circuit the process. They throw NumberFormatException.