Catch(Exception e){
}

in that what is Exception and purpose of that in that place
exactly?

Answer Posted / anjani kumar jha

Before understand the concept of Catch u have to understand
the concept of try,that is why try?

Try-------it is used when we know that some piece of code is
going to throw some exception example when u are dividing
somthing/0 means it may throw exception so we use the try
block and put that code inside the try block

Catch:--------Every try there must be catch or finally
block. Catch is used to catch to exception.As for example
the division example may throw airthmatic exception so will
declare this exception in catch like

Catch(AirthmaticException ae)
{
System.out.println("hi cannt divide by zero");
System.out.println(ae);
}

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does the “final” keyword mean in front of a variable? A method? A class?

546


Explain treeset?

593


What are keywords in programming?

567


Why do we use string?

581


What about anonymous inner classes in java?

563






Does unicode support all languages?

523


What does += mean in java?

576


Explain access specifiers?

661


What is mnemonic in assembly language?

554


How can constructor chaining be done by using the super keyword?

619


Explain the difference between runnable and callable interface in java?

588


Can private method static?

473


Can singleton class be inherited in java?

518


What is a buffer in computer?

514


Why can't we make a class private in java?

539