Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to unbox the Integer object to an int primitive.
Java
Integer num = 10; int value = num[1];
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
2fill in blank
mediumComplete the code to assign the unboxed Double value to a double variable.
Java
Double d = 5.5; double val = d[1];
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
3fill in blank
hardFix the error in unboxing the Boolean object to a boolean primitive.
Java
Boolean flag = Boolean.TRUE;
boolean isTrue = flag[1];🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
4fill in blank
hardFill both blanks to unbox the Character object and compare it to a char literal.
Java
Character ch = 'a'; if (ch[1] == '[2]') { System.out.println("Match"); }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
5fill in blank
hardFill all three blanks to create a map with unboxed keys and values from wrapper objects.
Java
Map<Integer, Double> map = new HashMap<>(); Integer key = 1; Double value = 2.5; map.put(key[1], value[2]); for (Map.Entry<Integer, Double> entry : map.entrySet()) { int k = entry.getKey(); double v = entry.getValue(); System.out.println(k [3] v); }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
