how to handle exceptions in core applications?
Answers were Sorted based on User's Feedback
in core java, we can handle the exception by the following
key words
1.try
2.catch
3.finally
4.throws(it throws only predefined exception)
5.throw(it throw both predefined and userdefined exception)
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / laxmi
In core applications we can handle the exceptions by using
try &catch blocks.
ex:
class excep
{
public static void main(String[] args)
{
try
{
System.out.println(2/0);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
Is This Answer Correct ? | 2 Yes | 0 No |
What is a compilation unit?
What is a Java Virtual Machine?
What are filterstreams?
What is merge sort in java?
What does || mean in code?
What is the maximum size of a string in java?
Can memory leak happen java?
Is multiple inheritance allowed in Java? Why ?
what is thread? What are the high-level thread states? : Java thread
What are the two ways in which thread can be created?
Explain what are final variable in java?
write java code to print second max number in the array