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
What does the “final” keyword mean in front of a variable? A method? A class?
Explain treeset?
What are keywords in programming?
Why do we use string?
What about anonymous inner classes in java?
Does unicode support all languages?
What does += mean in java?
Explain access specifiers?
What is mnemonic in assembly language?
How can constructor chaining be done by using the super keyword?
Explain the difference between runnable and callable interface in java?
Can private method static?
Can singleton class be inherited in java?
What is a buffer in computer?
Why can't we make a class private in java?