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
Which is fastest collection in java?
Explain the difference between abstract class and interface in java?
How do you sort a string in java?
What are the important features of Java 9 release?
Can we access instance variables within static methods ?
why are there separate wait and sleep methods? : Java thread
Which method you will use to create a new file to store some log data. Each time a new log entry is necessary, write string to the file in java ?
Is set sorted in java?
What is the difference between the ">>" and " >>>" operators in java?
Difference between static and dynamic class loading.
What is java autoboxing?
What is the purpose of assert keyword used in jdk1.4.x?
v-model life cycle
What is the null?
what is the difference between the methods sleep() and wait()? : Java thread