What will be the output of the program?
public class Foo
{
public static void main(String[] args)
{
try
{
return;
}
finally
{
System.out.println( "Finally" );
}
}
}
MANOJ KUMAR
ANSWER : Finally.
If you put a finally block after a try and its associated catch blocks, then once execution enters the try block, the code in that finally block will definitely be executed except in the following circumstances:
1.An exception arising in the finally block itself.
2.The death of the thread.
3.The use of System.exit()
4.Turning off the power to the CPU.
I suppose the last three could be classified as VM shutdown.
MANOJ KUMAR
ANSWER : Finally.
If you put a finally block after a try and its associated catch blocks, then once execution enters the try block, the code in that finally block will definitely be executed except in the following circumstances:
1. An exception arising in the finally block itself.
2.The death of the thread.
3.The use of System.exit()
4.Turning off the power to the CPU.
I suppose the last three could be classified as VM shutdown.
RANJIT VARADARAJAN
The ANSWER is Finally
If you put a finally block after a try and its associated catch blocks, then once execution enters the try block, the code in that finally block will definitely be executed except in the following circumstances:
1. An exception arising in the finally block itself.
2. The death of the thread.
3. The use of System.exit()
4. Turning off the power to the CPU.
I suppose the last three could be classified as VM shutdown.
suresh
The ANSWER is Finally
suresh
Finally
No output will be there as no exception is generated so no try nd no finally blk will be executed