Guided Notes
Exceptions & Debugging
Compile vs runtime errors, try/catch/finally, multiple catches, throwing and custom exceptions, try-with-resources, and debugging.
Kinds of errors
Slide 1 / 5β’ Compile errors β the code breaks Java's rules (a missing semicolon, a wrong type). javac refuses to build it and shows the file and line. β’ Runtime errors β exceptions thrown while the program runs, such as dividing an int by zero or using a null reference. β’ Logic errors β the program runs but gives the wrong answer. No error message; you find them by testing.
The compiler catches the first kind; exception handling deals with the second; tests catch the third.
