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 parsing in java?
How would you format a date in java? I.e. In the ddmmyyy format?
Explain notifyall() method of object class ?
What is function declaration?
Explain about java sdk?
What is the finalize method do?
Why char array is favored over string for the storage of passwords?
What is Enum in Java?
Write an algorithm for quick sort?
What will be the default values of all the elements of an array defined as an instance variable?
How do you define a variable?
Which package has light weight components in java programming?
What happens when you add a double value to a string?
Is set sorted in java?
Can java program run without jre?