Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Alma Austin   on Apr 27 In Java Category.

  
Question Answered By: Leroy Schmidt   on Apr 27

Your Porgram is correct.It would be more accurate if you
use "java.lang.ArithmeticException " instead of generic exception.
Because you are of exception  goin to occuer.
The exception get caught and the control  goes to the catch block. it
finds only return  statement. so it comes out of the programme and so
only to the command prompt.the follwoing example (little modification
of your prog) would lt you to understand better.

class test
{
public static  void main(String a[])
{
try
int  i=2;
int j=i/0;
}
catch(java.lang.ArithmeticException e)
{
System.out.println("I have caught exception "+e);
return;
}
}
}

let me know if you have any other query

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on regarding exception Or get search suggestion and latest updates.


Tagged: