| プリミティブ型 | ラッパークラス |
| byte | Byte |
| short | Short |
| int | Integer |
| long | Long |
| float | Float |
| double | Double |
| char | Character |
| boolean | Boolean |
//Sample20_04.java class Sample20_04{ public static void main(String[] args){ byte byt = 54; Byte obyt = new Byte (byt); System.out.println(obyt.byteValue()); short s = 1260; Short os = new Short (s); System.out.println(os.shortValue()); int i = 9980; Integer oi = new Integer (i); System.out.println(oi.intValue()); long l = 112980; Long ol = new Long (l); System.out.println(ol.longValue()); float f = 7.25f; Float of = new Float (f); System.out.println(of.floatValue()); double d = 19800.5; Double od = new Double (d); System.out.println(od.doubleValue()); char c = 'A'; Character oc = new Character (c); System.out.println(oc.charValue()); boolean boo = true; Boolean oboo = new Boolean (boo); System.out.println(oboo.booleanValue()); } }
ws>cd ws ws>javac Sample20_04.java ws>java Sample20_04 54 1260 9980 112980 7.25 19800.5 A true