xxxValue() from primitive wrappers takes no arguments, returns a primitive
parseXxx() from primitive wrappers takes a String, returns a primitive
valueOf() from primitive wrappers takes a String, returns a wrapped object
Wrapper constructors can take a String or a primitive, except for Character, which can only take a char.
Radix refers to bases (typically) other than 10; octal is radix = 8, hex = 16.
Boxing allows you to convert primitives to wrappers or to convert wrappers to primitives automatically.
public class MainClass {
public static void main(String args[]) {
Boolean b1 = new Boolean("TRUE");
Boolean b2 = new Boolean("FALSE");
System.out.println(b1.toString()+" or "+b2.toString());
for(int j=0;j<16;++j){
System.out.print(Character.forDigit(j,16));
}
Integer i = new Integer(Integer.parseInt("ef",16));
Long l = new Long(Long.parseLong("abcd",16));
long m=l.longValue()*i.longValue();
System.out.println(Long.toString(m,8));
System.out.println(Float.MIN_VALUE);
System.out.println(Double.MAX_VALUE);
}
}
|