From 32b14ba0544f4a047cf07a405f0e89f8b53bf79c Mon Sep 17 00:00:00 2001 From: "nshizirungudieumerci@gmail.com" Date: Thu, 13 Aug 2026 14:22:28 -0400 Subject: [PATCH] added a select all that apply multiple choice question --- source/ch9_commonmistakes.ptx | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/source/ch9_commonmistakes.ptx b/source/ch9_commonmistakes.ptx index 4dca391..867a93b 100644 --- a/source/ch9_commonmistakes.ptx +++ b/source/ch9_commonmistakes.ptx @@ -228,6 +228,57 @@

+ + +

+ Based on , select all of the + statements that are true about creating objects in Java. +

+
+ + + +

Java requires the new keyword to create a new object.

+
+ +

Correct! Unlike Python, Java needs the new keyword to instantiate an object.

+
+
+ + +

Writing data = new Scanner(new File("test.dat")); would fix the error.

+
+ +

Correct! Adding new before Scanner properly creates the object and resolves the error.

+
+
+ + +

Scanner is a constructor of the Scanner class, not a standalone method.

+
+ +

Correct! Because Scanner is a constructor, it must be called with new.

+
+
+ + +

Java can create objects without a keyword, just like Python.

+
+ +

Incorrect. Unlike Python, Java requires the new keyword to instantiate objects.

+
+
+ + +

The "cannot find symbol" error here means the Scanner class was not imported.

+
+ +

Incorrect. The Scanner class is imported; the error is caused by the missing new keyword.

+
+
+
+
+