diff --git a/source/ch9_commonmistakes.ptx b/source/ch9_commonmistakes.ptx index 64b59cd..4dca391 100644 --- a/source/ch9_commonmistakes.ptx +++ b/source/ch9_commonmistakes.ptx @@ -115,6 +115,56 @@
The 'cannot find symbol' error for the variable
+ Based on
Every variable must be declared with a data type before it is used.
+Correct! Java requires a variable to be declared with its type before it can be assigned or referenced.
+The "cannot find symbol" error happens because
Correct! That error means the compiler reached a variable it has no declaration for.
+Writing
Correct! Declaring
Java lets you use a variable without declaring it first, just like Python.
+Incorrect. Unlike Python, Java requires all variables to be declared before use.
+The error can be fixed by adding an import statement.
+Incorrect. The import is already present; the problem is the missing variable declaration, not a missing import.
+