Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the ArrayList class from java.util package.
Java
import java.util.[1]; public class Main { public static void main(String[] args) { ArrayList<String> list = new ArrayList<>(); } }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
2fill in blank
mediumComplete the code to import all classes from the java.io package.
Java
import java.io[1]; public class Main { public static void main(String[] args) { // code using java.io classes } }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
3fill in blank
hardFix the error in the import statement to correctly import the HashMap class.
Java
import java.util.[1]; public class Main { public static void main(String[] args) { HashMap<String, Integer> map = new HashMap<>(); } }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
4fill in blank
hardFill both blanks to import the Scanner class and create a Scanner object.
Java
import java.util.[1]; public class Main { public static void main(String[] args) { [2] scanner = new Scanner(System.in); } }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
5fill in blank
hardFill all three blanks to import the List interface, declare a List variable, and initialize it with an ArrayList.
Java
import java.util.[1]; import java.util.[2]; public class Main { public static void main(String[] args) { [3]<String> list = new ArrayList<>(); } }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
