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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
| import org.junit.Test;
public class WrapperTest { @Test public void test5(){ String str1 = "123";
int num2 = Integer.parseInt(str1); System.out.println(num2 + 1); String str2 = "true1"; boolean b1 = Boolean.parseBoolean(str2); System.out.println(b1); } @Test public void test4(){ int num1 = 10; String str1 = num1 + ""; float f1 = 12.3f; String str2 = String.valueOf(f1); Double d1 = new Double(12.4); String str3 = String.valueOf(d1); System.out.println(str2); System.out.println(str3); }
@Test public void test3(){
int num2 = 10; Integer in1 = num2; boolean b1 = true; Boolean b2 = b1; System.out.println(in1.toString()); int num3 = in1; } public void method(Object obj){ System.out.println(obj); } @Test public void test2(){ Integer in1 = new Integer(12); int i1 = in1.intValue(); System.out.println(i1 + 1); Float f1 = new Float(12.3); float f2 = f1.floatValue(); System.out.println(f2 + 1); } @Test public void test1(){ int num1 = 10;
Integer in1 = new Integer(num1); System.out.println(in1.toString()); Integer in2 = new Integer("123"); System.out.println(in2.toString());
Float f1 = new Float(12.3f); Float f2 = new Float("12.3"); System.out.println(f1); System.out.println(f2); Boolean b1 = new Boolean(true); Boolean b2 = new Boolean("TrUe"); System.out.println(b2); Boolean b3 = new Boolean("true123"); System.out.println(b3); Order order = new Order(); System.out.println(order.isMale); System.out.println(order.isFemale); } }
class Order{ boolean isMale; Boolean isFemale; }
|