Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a new object of class Car.
Java
Car myCar = new [1]();🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
2fill in blank
mediumComplete the code to call the method that destroys an object reference.
Java
myCar = [1];🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
3fill in blank
hardFix the error in the code that tries to finalize an object.
Java
protected void [1]() throws Throwable { System.out.println("Cleaning up"); super.finalize(); }
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
4fill in blank
hardFill both blanks to create an object and then remove its reference.
Java
Car [1] = new [2]();
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
5fill in blank
hardFill all three blanks to create a new object, assign null, and print a message.
Java
Car [1] = new [2](); [1] = [3]; System.out.println("Object reference removed");
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
