-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2boxing.java
More file actions
27 lines (23 loc) · 1.23 KB
/
Copy path2boxing.java
File metadata and controls
27 lines (23 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
public class 2boxing {
public static void main(String[] args) {
Integer boxedInt = Integer.valueOf(10);
Double boxedDouble = Double.valueOf(20.5);
Character boxedChar = Character.valueOf('A');
Boolean boxedBoolean = Boolean.valueOf(true);
Float boxedFloat = Float.valueOf(30.5f);
int unboxedInt = boxedInt.intValue();
double unboxedDouble = boxedDouble.doubleValue();
char unboxedChar = boxedChar.charValue();
boolean unboxedBoolean = boxedBoolean.booleanValue();
float unboxedFloat = boxedFloat.floatValue();
System.out.println("Boxed Integer: ;" + boxedInt);
System.out.println("Unboxed Integer: " + unboxedInt);
System.out.println("Boxed Double: " + boxedDouble);
System.out.println("Unboxed Double:" + unboxedDouble);
System.out.println("Boxed Character:" + boxedChar);
System.out.println("Unboxed Character:" + unboxedChar);
System.out.println("Boxed Boolean:" + boxedBoolean);
System.out.println("Unboxed Boolean:" + unboxedBoolean);
System.out.println("Boxed Float:" + boxedFloat);
System.out.println("Unboxed Float:" + unboxedFloat);
}}