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 is a protected method?
Is a boolean variable?
Explain exception chaining in java?
Variable of the boolean type is automatically initialized as?
What is a databasemetadata?
What is method overloading with type promotion?
Can we create an object of private class?
How is a variable stored in memory?
Can we assign the reference to this variable?
Why are constructors used?
How is it possible in java programming for two string objects with identical values not to be equal under the == operator?
How do I remove a character from a string in java?
What is append function?
What is numeric function?
Is sizeof a keyword in java programming?