Misconception: students develop the habit of putting the type in front of variables; they don’t realize that this creates a new variable resulting in lots of variables with the same name.

  • A typical result of this error is null pointer exception.
  • Novice students struggle to understand how you can have multiple variables with the same name.
    • It’s best to have a rule against this in intro classes and save explaining having multiple variables with the same name for more advanced courses.
    • In order to help them understand what is happening, have a simple rule about declaring globally means deleting the type in front of the variable locally.

More about this tip

External Source

Interview with Dani McAvoy