Wrapping a Primitive Type in a Wrapper Object: boolean, byte, char, short, int, long, float, double
public class Main {
public static void main(String[] argv) throws Exception {
Boolean refBoolean = new Boolean(true);
boolean bool = refBoolean.booleanValue();
Byte refByte = new Byte((byte) 123);
byte b = refByte.byteValue();
Character refChar = new Character('x');
char c = refChar.charValue();
Short refShort = new Short((short) 123);
short s = refShort.shortValue();
Integer refInt = new Integer(123);
int i = refInt.intValue();
Long refLong = new Long(123L);
long l = refLong.longValue();
Float refFloat = new Float(12.3F);
float f = refFloat.floatValue();
Double refDouble = new Double(12.3D);
double d = refDouble.doubleValue();
}
}
Related examples in the same category