You are on page 1of 1

Runtime Exception-->

1:NumberFormatException--->
ex.
String str="hi"
int i=Integer.parseInt(str);//its a runtime exception so no need to handle it ,i
f u want u might
2:Null pointerException-->
its comes when obj=null,and we want to acsses obj.getValue();//so here its gives
the runtime exception.
3:ClassCastException->
its comes when we cast super class object to subclass..
Animal is a super class and Dog is a subclass then we can say that Dog is an Ani
mal.

code..
Animal a=new Animal();
Dog=a;//here its fire the exception classCastException so we need to correct it.
.
Dog=(Dog) a;here explicit cast required.

4:Airthmatic Exception->
if someone use 5/0 (divide by zero)means wrong use of operator then it occurs.

5:ArrayOutOfBoundException-->
......................................
airthmaticException is only exception we can write inside catch block and code c
ompile and run properly.

Checked Exception-->
1:IOException-->its comes when somthing wrong during the file reading operation.
.

You might also like