Answer Posted / anandh
Try and Catch block is used for Exception handling..
Try block is used for monitor the errors and using catch
block we can shows to users what type of Exception occurred
in our program ...see the following Example code it can be
useful..
class ExceptionExample
{
public static void main(String args[])
{
int d, a;
try
{
d = 0;
a = 42 / d;
System.out.println("This will not be printed.");
}
catch (ArithmeticException e)
{
System.out.println("Division by zero.");// Here shows
Exception to user
}
}
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
How many times finalize method will be invoked? Who invokes finalize() method in java?
How do you compare two strings lexicographically?
Explain what is Marker interface?
What is the generic class?
Explain about static nested classes in java?
What is a generic type?
What are the java ide’s?
What is listnode in java?
What is parameters example?
What is a jagged array in java?
What is assembly used for?
Wha is the output from system.out.println(“hello”+null); ?
1.IN CASE OF DYNAMIC METHOD DISPATCH WHY WE USE REFERENCE VARIABLE,WE CAN USE THE DIFFERENT DEFINED OBJECT DIRECTLY TO ACCESS THE DATA MEMBER AND MEMBER FUNCTION OF THAT RESPECTIVE CLASS?WHAT IS THE MAIN FUNCTION OF "REFERENCE VARIABLE" HERE?
List some features of the abstract class.
what is the major difference between linkedlist and arraylist in java?