Complete the code to create an Integer wrapper object from a primitive int.
Integer num = [1];Wrapper classes like Integer can be created using the new Integer(value) constructor to wrap a primitive int.
Complete the code to convert a String to an Integer using wrapper class methods.
Integer num = Integer.[1]("123");
The valueOf method converts a String to an Integer object.
Fix the error in the code to correctly convert an Integer to a primitive int.
int value = num.[1]();The intValue() method returns the primitive int value from an Integer object.
Fill both blanks to create a list of Integer objects from an array of ints.
int[] arr = {1, 2, 3};
List<Integer> list = new ArrayList<>();
for (int num : arr) {
list.[1](Integer.[2](num));
}Use add to add elements to the list and Integer.valueOf(num) to convert primitive int to Integer object.
Fill all three blanks to create a map of String keys to Integer values where values are only added if greater than 10.
Map<String, Integer> map = new HashMap<>(); for (String key : keys) { Integer val = Integer.[1](key.length()); if (val [2] 10) { map.[3](key, val); } }
Use Integer.valueOf to convert int to Integer, the comparison operator > to check if value is greater than 10, and put to add entries to the map.
