Java | Exception Handling :

           ~~ CORE-JAVA ~~

 1. INTORDUCTION

     1.1 Java Intorduction
     1.2 Java history
     1.3 Java features
     1.4 Diff b/w Java & C++
     1.5 Java Variables
     1.6 Java Data Types
     1.7 Typecasting
     1.8 Arrays

 2. OOPS

     2.1 Introduction
     2.2 Class
     2.3 Object
     2.4 Static Keywords
     2.5 Constructors
     2.6 This KeyWord

 3. INHERITANCE

     3.1 Inheritance (IS-A) 
     3.2 Aggregation (HAS-A)

 4. POLYMORPHISM

     4.1 Polymorphism & Its Type
     4.2 Method Overloading
     4.3 Method Overriding
     4.4 Super Keyword
     4.5 Final Keyword
     4.6 Dynamic Binding

 5. ABSTRACTION

     5.1 Abstract Classes & Methods
     5.2 Interfaces
     5.3 Abstract vs Interface

 6. ENCAPSULATION

     6.1 Encapsulation

 7. STRING MANIPULATIONS

     7.1 String
     7.2 String Buffer
     7.3 String Tokenizer

 8. PACKAGES

     8.1 Predefined packages
     8.2 Userdefined Packages
     8.3 Access Specifiers

 9. EXCEPTION HANDLING

     9.1 Introduction
     9.2 Try-Catch-Finally
     9.3 Throws-Throw Keyword
     9.4 Built-in Exception
     9.5 Customized Exception

 10. MULTITHREADING

     10.1 Introduction
     10.2 Thread Creations
     10.3 Thread Life Cycle
     10.4 Life Cycle Methods
     10.5 Synchronization
     10.6 Wait() notify() notify all()

 11. WRAPPERCLASSES

     11.1 Introduction
     11.2 Wrapper Classes

 12. COLLECTION FRAME WORK

     12.1 Introduction
     12.2 List interface
     12.3 Set interface                     12.4 Map interface                           

 13. INNER CLASSES

     13.1 Introduction
     13.2 Member inner class
     13.3 Static inner class
     13.4 Local inner class
     13.5 Anonymous inner class

 14. CoreJava Interview Questions

Error :

As Softwate Programmer, there is possibilities of some mistake while designing or developing the project, these mistakes create some problem these are known as nothing but “Error”.

 

Types of Errors :

  1. Compile Time Errors
    • These are normally syntactical error found in the code, due to which our program will fail to compile.
  2. Run Time Errors
    • These are such type of unwanted or unexpected error which occurs on run time only by JVM.
  3. Logical Errors
    • When programmer used some wrong formula or logic because of that, expected outuput is not coming, is nothing but Logical Errors.

Exceptions :

  • When some unwanted, unexpected event occurs in our program which disturbs the normal flow is nothing but Exceptions.
    • Basically Exceptions are such type of Run Time Errors, but there are such type of Execeptions also there which occurs at Compile Time.

 

Types of Exceptions :

Checked Exception :

  • The exceptions that are checked by Compiler at Run Time, these are “Checked Exceptions”. Below are some Checked Exceptions :
    • ClassNotFoundException
    • IOException
    • SQLException
    • FileNotFoundException 

 

UnChecked Exception :

  • The exceptions that occurs on Run Time by JVM, are called “Unchecked Exceptions”. Unchecked Exceptions and Errors are considered as unrecoverable and the programmer can’t do anything when they occurs.
  • All Runtime Exceptions comes under Unchecked Exception. Below are some Unchecked Exceptions :
    • Arithmetic Exceptions
    • ClassCastException
    • NullPointerException
    • ArrayIndexOutOfBoundsException

 

Exception Hierarchy :

exceptions hierarchy
  • Here Throwable Class acts as a root for all entire Java Exception Hierarchy.
  • Throwable class comes under java.lang package.
  • It has 2 child class as we can see in above flow :
    • Exceptions
    • Error  

 

Difference between Error vs Exceptions :

 

Help Others, Please Share