Complete the code to declare a primitive integer variable.
int number = [1];The primitive type int stores the value directly. So assigning 10 is correct.
Complete the code to create a reference to a String object.
String text = [1];Strings are objects in Java, so they are referenced by variables. Use quotes to create a String literal.
Fix the error in the code to assign a new Integer object to a variable.
Integer value = [1];To assign an Integer object explicitly, use new Integer(10). The others are either primitives or methods returning int.
Fill both blanks to create an array of primitive ints and assign a value.
int[] numbers = new int[[1]]; numbers[[2]] = 5;
The array size is 3, and the first index is 0. So assigning 5 to numbers[0] is correct.
Fill all three blanks to create a String array, assign a value, and print it.
String[] words = new String[[1]]; words[[2]] = [3]; System.out.println(words[0]);
The array size is 2, index 0 is assigned the string "hello", and printing words[0] outputs 'hello'.
