the use of try and ffinally keyword
Answer / xavier
try and finally are keywords associated with exception
handling(run time errors)
try block provides two benefits it allows you to fix the error.
it prevents program from automatically terminating
e.g.
class Exception_handling
{
public static void main(String args[]){
try{
int d=0;
int x= 42/d;
System.out.println("this will not be printed");
}
catch(Exception e)(
System.out.println("this will be printed");
}
}
}
you might observe that in above code the line after int
x=42/d is not printed but there are certain operations that
you need to perform before proceeding further and finally
would serve this purpose
class Exception_handling
{
public static void main(String args[]){
try{
int d=0;
int x= 42/d;
System.out.println("this will not be printed");
}
catch(Exception e)(
System.out.println("this will be printed");
}
finally{
system.out.println("this will be printed");
}
}
}
| Is This Answer Correct ? | 10 Yes | 0 No |
wahts is mean by dynavalidatorform in struts/
cud u help me ... i am struggling with this question... to find all the subsets of a given set for ex.... a,,b,c shud give all the subsets.... i gt the program in c bt nt able to get it in java..... help needed ..
What are the sequence of steps to write pub or sub model kind of application?
Which class is the immediate superclass of the menucomponent class?
Difference between loadclass and class.forname?
How to get an image from db2 database plz help as soon as possible
What is permgen or permanent generation?
What is the difference between the ‘font’ and ‘fontmetrics’ class?
What is Stream Tokenizer?
Explain the steps in details to load the server object dynamically?
How is a java object message delivered to a non-java client?
What invokes a thread?s run() method?