Complete the code to declare a String variable named greeting.
String greeting = [1];In Java, String values must be enclosed in double quotes.
Complete the code to create a new Integer object with value 10.
Integer number = [1];new.To create an Integer object, use the new keyword with the constructor.
Fix the error in the code to compare two String objects correctly.
if (str1.[1](str2)) { System.out.println("Strings are equal"); }
== to compare Strings, which compares references, not content.equals without parentheses, which is a syntax error.Use the equals() method to compare the contents of two String objects.
Fill both blanks to create an array of Strings and assign a value to the first element.
String[] names = new String[[1]]; names[[2]] = "Alice";
The array size is 3, and the first element index is 0.
Fill all three blanks to create a HashMap, add a key-value pair, and retrieve a value.
Map<String, Integer> map = new [1]<>(); map.[2]("age", 25); int age = map.[3]("age");
TreeMap instead of HashMap (both work but only one is correct here).get to add entries or put to retrieve values.Use HashMap to create the map, put to add entries, and get to retrieve values.
