Run Time Errors vs. Compile Time Errors



  • Compile time errors occur when a program is being compiled (translated) into the machine's language
  • Run time errors occur when a program is running

Common Compile Time Errors

  • Omitting semi-colon or braces
  • using undeclared identifiers
  • having parameters that don't match
  • assigning a variable a type that doesn't match (String s = 5)


Common Run Time Errors

  • diving by zero
  • using an array index that is out of bounds
  • entering data that doesn't match what is expected
    int n = in.getInt(); (and you type in Joe)