Core Java Development Course for Beginners - Part 7 - Java Exceptions | Udayan Khattry | Skillshare

Core Java Development Course for Beginners - Part 7 - Java Exceptions

Udayan Khattry, SCJP, SCWCD & Oracle Database SQL Certif

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
12 Videos (2h 5m)
    • Introduction to Java Exceptions

    • Java Exception Handling Framework 1

    • Java Exception Handling Framework 2

    • Checked and unchecked exceptions

    • More on try catch blocks 1

    • More on try catch blocks 2

    • How to handle Runtime Exceptions

    • Overriding Rules

    • finally block 1

    • finally block 2

    • try with resources

    • Eclipse Debugging Exception Breakpoint


About This Class


This course is for anyone who wants to learn Java from scratch, polish java skills, face java interviews and prepare for java certifications.

Anyone can take this course and go from 0 developments skills to being expert in OOPs and core Java.
Java is the most popular language world wide and technologies like Servlets & JSP, J2EE, Struts, Spring, Hibernate, JMS or android for mobile applications are all based on core Java. 
Even Kotlin (android's new programming language) becomes easier if you know Java.

Having a sound understanding of core java concepts is necessary, if you want to learn advance concepts, frameworks and android programming.

Following Lectures are covered in Part-7

1.            Introduction to Java Exceptions

In this lecture you will learn:

  • What is an exception?
  • What is default exception handler and how it handles exceptional events?
  • Explanation of stack trace printed on to the console.

2.            Java Exception Handling Framework

In this lecture you will learn:

  • What is traditional exception/error handling approach?
  • How business logic is mixed with error handling code in the traditional approach?
  • How Java exception handling framework separates error handling logic from business logic?
  • An example on Java exception handling framework using FileInputStream class.
  • To provide try-catch block for error causing statement.
  • How java runtime handles the code containing try-catch block?
  • Hierarchy of ArithmeticException class.
  • getMessage(), printStackTrace() and toString() methods of Throwable class.
  • Throwable and its subtypes are allowed in catch block but Object type is not allowed.
  • To provide try-catch block for the method call(causing runtime error).
  • try without catch or finally block is not possible.

3.            Checked and unchecked exceptions

In this lecture you will learn:

  • Exception framework hierarchy.
  • What are checked and unchecked exceptions.
  • Differences between checked and unchecked exceptions.
  • How to create and use custom exception classes?
  • What is Handle or Declare rule for checked exceptions?
  • throw and throws keywords.
  • How to provide cause/message to custom exception classes?
  • What does "ducking the exception" mean?

4.            More on try-catch blocks

In this lecture you will learn:

  • A method can specify multiple exceptions in its throws clause.
  • How to handle multiple exceptions thrown by a method?
  • Super type Exception class specified in catch block can handle all the sub types.
  • Why is it not advisable to provide one catch for all exceptions?
  • Does the order of catch blocks matter?
  • try-catch blocks should be continuous without any statements in between.
  • multi-catch statements.
  • Some best practices related to exceptions.
  • Methods can declare checked exceptions but may not throw those exceptions.
  • How to re-throw the same exception object?
  • How to throw a custom exception object?
  • How to link exception objects?
  • Nested try-catch blocks.

5.            How to handle Runtime Exceptions?

In this lecture you will learn:

  • ArithmeticException (/ by 0) is handled by checking the denominator value.
  • NullPointerException is handled by doing not null check.
  • ArrayIndexOutOfBoundsException is handled by checking index boundary.

6.            Overriding Rules

In this lecture you will learn:

  • Overriding rules related to methods throwing exceptions.
  • Some tricky scenarios of polymorphic method calls.

7.            finally block

In this lecture you will learn:

  • What is the need of finally block in Java?
  • Syntax of finally block.
  • When does finally block get executed?
  • Order of try, catch and finally block, when all the 3 blocks are present.
  • try-finally without catch block is a valid Java syntax.
  • The cases for which finally block is executed and the case for which it is not executed.

8.            try-with-resources

In this lecture you will learn:

  • Why try-with-resources statement was added in Java?
  • Syntax of try-with-resources statement.
  • Difference between closing the resource using try-with-resources statement and closing it in finally block.
  • The order of closing the resources, in case we have multiple resources in try-with-resources statement.
  • try-with-resources statement without catch or finally is a valid syntax.
  • Resources declared in try-with-resources statement are implicitly final.

9.            Eclipse Debugging: Exception Breakpoint

In this lecture you will learn:

  • How to debug exceptional events in Eclipse IDE?
  • Usage of conditional suspension in debugging exceptional events.
  • Exception breakpoints and their usage in debugging exceptional events.





  • --
  • Beginner
  • Intermediate
  • Advanced
  • All Levels
  • Beg/Int
  • Int/Adv


Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

Udayan Khattry

SCJP, SCWCD & Oracle Database SQL Certif

Hi, I'm Udayan. I have a master's degree in Computer Applications from Symbiosis International University, Pune, India and have completed following professional certifications:
- SCJP 1.6 (Sun Certified Programmer for J2SE 6.0)
- SCWCD 1.5 (Sun Certified Web Component Developer)
- Oracle Database SQL Certified Expert

After working as a software developer and consultant for over 9 years for various companies in India, Dubai & Singapore, I decided to follow my lifelong passion ...

See full profile

Report class