■ All wrappers take Strings in double quotes as well as numbers for constructor parameters.
■ char’s wrapper class’s name is the full word Character. It's not "Char".
■ int's wrapper class is named Integer. It's not "Int".
■ All the basic wrapper classes are immutable. Contents can't be changed.
■ Watch the required types in constructors. i.e.
Long L = new Long( x ); Is good only if x was some integer type. A double or float gives a compile error.
Integer I = new Integer( x ); Is OK only if x was an integer type of int or smaller, meaning not a long.
A long gives a compile error.
■ All the numeric wrapper classes have these special final static values for assigning to primitives:
■ You can cast up automatically when assigning wrapper values. i.e.
int x = Byte.MAX_VALUE; compiles OK
byte b = Integer.MAX_VALUE; won't work as ints are too big for bytes
■ Only Float and Double have NEGATIVE_INFINITY and POSITIVE_INFINITY. There's no Integer.MAX_VALUE. There's no Character.MAX_VALUE etc.
■ Wrapperclassname.NEGATIVE_INFINITY is the value of any negative divided by zero.
■ Note that toString( ) returns the word “–Infinity” for NEGATIVE_INFINITY.
■ Wrapperclassname.POSITIVE_INFINITY is the value of any a positive divided by zero.
■ Note toString( ) gives Infinity for POSITIVE_INFINITY.
■ Printing any wrapper object containing NaN prints the word NaN. i.e.
toString( ) on a NaN gives the word NaN
■ Boolean and Character are the two which don’t extend Number.
■ Character alone has no toString( ) method.
■ Byte, Short, and Long don't take an int in their constuctors - they need a String (or a b, s, or l primitive, respectively). i.e.
Byte B = new Byte(5); won't compile
Byte B = new Byte("5"); works.
■ Integer takes an int OK in its constructor. Also Float and Double take float and double primitives OK.
■ Float takes doubles too.