Sound Bites

  • What to do when you get a NullPointerException: Look at the line where the NullPointerException occurred.  For each dot (.) on that line, think about whether it is possible for what is to the left of the dot to be null.
  • Always use this. preceding references to fields and methods in the receiver.  If you don't do it, Java will do it for you but not always the way you expect.  If you do, then your code becomes easier for you to understand and easier for others to read.
  • Get your code to compile always.  You should save and compile your code every few seconds.  Get your code to compile before you fix any other problem or start adding more methods.
  • You might be surprised at how far I will go in answering questions in class if I get questions early enough.