[Java] Exceptions

조현호_ChoHyeonHo·2024년 12월 20일

Tihs study about exception is not including any practice concerning practice only for exception will be lead to rabbit hole. I'll look it again when I have to.

Names

  • Exception: Errors occuring during runtime or compile time.
  • Purpose of Exception: Prevents the program to be not quitted in abnormal ways.
  • Lists: Types of Exception(depends on when it happens)
    • Checked Exception: Exceptions that must be dealt during compile.
    • Unchecked Exception: Not mandatory. Occurs during runtime.
  • Lists: Heirarchy of Exception Class
    • Throwable
      • Error: Serious error on system level.(ex. OutOfMemoryError, StackOverflowError)
      • Exception: Exceptions that can be dealt on app level(ex. checked/unchcked exception)
  • try: area for code might occuring exception.
  • catch: deals the error from above.
  • finally: area for code should be finally ran. Mostly used for closing resources. (file close, DB connection close)
  • throws: Declares the method can throw exceptions so that the caller of the method can deal with it.
  • CustomException: User defined exception implemented by extending Exception class.
profile
Behold the rabbit hole

0개의 댓글