questions based on Program 4: 1 7/Program 4 2 ; Integer il = (i) String strval = "77"; Character cl = 'm'; int i 2 = (ii) char c2 = cl; 11 )); 8 9 10 11 12 13 14 15 System.out.println("Value of i1: + il); System.out.println("Value of i2: " + (i2 + (iii) System.out.println("Value of c1: " + c1); System.out.println("Value of c2: " + (char) (c2 + 5)); } } a) Complete Program 4 by filling in the blanks with an appropriate statement based on the output shown in Figure 2. Value of i1: 44 Value of i2: 121 Value of c1: m Value of c2: r
0 (i) i1.integerValue (44) 0 (ii) Int. intValue(il) b) Assuming Program 4 has been completed, identify the two statements in Program 4 that perform unboxing. Line 6 O Line 4 Line 7 O Line 8 Line 5
Value of c1: m Value of c2: r Figure 2 Int.intValue (44) оооооо 0 (iii) strval.intValue() O (ii) Integer.parseInt(il) 0 (0) Int.parseInt(44) Int.valueOf(44) O i il. intValue Integer.valueOf (44) o (i) Integer.intValue(44) 0 ) Integer.parseInteger(strval) 0 (ii) Int.valueOf(il) 0 (i) Integer.parseInt(44) o (i) Integer.parseInteger (44) (ii) Int.parseInt(44) O iii) Int.parseInt(strval) Integer.intValue (il) O ii) Integer.intValue(strval) (iii) Integer.parseInt(strval) o iii) Int.valueof(strval) 0 (i) i1.integerValue (44)
Answer the following Answer the following questions based on Program 4: 1 7/Program 4 2 ; Integer il = (i) String strval = "77"; Character cl
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am