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
Why multiple inheritance is not supported by java?
What is the association?
Can you inherit a constructor java?
Can we sort a map in java?
What is the type of lambda expression?
How is garbage collection controlled?
Variables used in a switch statement can be used with which datatypes?
What is array list in java?
How are variables stored?
What is ordered map in java?
What is method in java with example?
Difference between ‘>>’ and ‘>>>’ operators in java?
Why should I use abstract class?
What are the advantages and disadvantages of reference counting in garbage collection?
Why use string handling in Java?