Use this list of common coding errors to help students debug.

  • Debugging is hard, knowing common mistakes can make it much easier to help students.
  • Common errors include the following:
    • Not naming a class the same as saved file name.
    • Case sensitive typos.
    • Using the number 1 versus the letter l. Especially in the Java print statement, System.out.println("Text Here");.
    • Using a semicolon— ; —after a while statement.
    • Putting a return type with constructors.
    • Confusion regarding the order of operations.
    • Messing up braces: using {} instead of [] or ().
    • Putting parenthesis after the length method for Arrays in Java, it’s just .length without parenthesis.
      • Students get really confused here because the Java method .size() for ArrayList has parentheses.
    • With interface, students don’t realize you don’t need abstract in front of every method
    • Confusion with implement versus extend, often saying "extend" when they mean implement.
    • Confusion with super.method() and super(), the constructor call.
      • This needs to be rote memorized, practiced, and reinforced frequently.
    • Forgetting curly braces {} with loops.
    • Out of bounds errors in loops. Looping to x+1 when students only need to loop to x-1.
      • If you don’t minus one from the last element you want to look at you go out of bounds.
    • Modulo, when students see modular arithmetic (e.g., 7%2) they cannot remember which number divides which.

More about this tip

External Source

Interview with Seth Reichelson