Common Mistakes To Avoid
Understand the common mistakes and errors in order to avoid them.
We'll cover the following
❌ Common pitfalls
The following common mistakes should be avoided:
-
Naming a variable after a keyword (reserved name), e.g.,
int
-
Declaring a variable as
myVar
and using it asMyVar
throughout the program -
Using a variable without declaring it
-
Initializing a variable with a value of a different type
-
Trying to update/ change the value of the
final
type variable -
Writing
var += 2
asvar += var + 2
-
Considering
var++
to be the same as++var
-
Dividing a variable by
Get hands-on with 1400+ tech skills courses.