Java All Exceptions Tutorial

Java All Exceptions Tutorial

1. Exceptions – Meaning
2. Runtime Error – Groups – Exception causes
3. Exception Handling: try – catch
4. try – catch – finally
5. Hierarchy of Exceptions – Checked/Unchecked Exceptions
6. Throwing with "throws" – Alternative to try-catch
7. Creating User-defined Exceptions – throw Keyword
8. getMessage() & printStackTrace()
9. Try – Finally (without Catch)
10. Rules of Exceptions in Method Overriding

Some commonly occurring exceptions, elaborately discussed.

NumberFormatException NoSuchMethodError
ClassNotFoundException IllegalArgumentException
MalformedURLException UnknownHostException
IllegalThreadStateException ClassCastException
RuntimeException IndexOutOfBoundsException
FileNotFoundException & IOException InterruptedException

7 thoughts on “Java All Exceptions Tutorial

  1. sathya

    public void run(){
    for(int i=1;i<5;i++){
    try{Thread.sleep(500);}catch(InterruptedException e){System.out.println(e);}
    public static void main(String args[]){
    TestCallRun2 t1=new TestCallRun2();
    TestCallRun2 t2=new TestCallRun2();;


    in this program pl explain the difference between t1.start();and;?
    what they actually does?

    1. S. Nageswara Rao, Corporate Trainer Post author

      Every thread has a life cycle (4 states exist) maintained by JVM like getting into dead state when the job of the thread is over. If you call run() method, the life cycle is not taken care of. There may not be difference in output, but many internal things do not happen what a thread is eligible.

Leave a Reply

Your email address will not be published. Required fields are marked *