what is the purpose of the final in the try-catch-final

Answers were Sorted based on User's Feedback



what is the purpose of the final in the try-catch-final..

Answer / vikas

final- declares a constant
finally- handles exceptions
finalize- helps in Garbage collection

Is This Answer Correct ?    10 Yes 1 No

what is the purpose of the final in the try-catch-final..

Answer / srinivasa

Finally is a block where we can write the code to free up
the resources like File closing,socket obj closing .

Is This Answer Correct ?    6 Yes 0 No

what is the purpose of the final in the try-catch-final..

Answer / ramakrishna challapalli

finally is an optional one its not a mandatory statement
after try-catch blocks

Is This Answer Correct ?    3 Yes 0 No

what is the purpose of the final in the try-catch-final..

Answer / guest

finally will execute after catch block if try throw
exception else it will execute after try.

ex:

class a
{
public static void main(String []asd)
{

try
{
throw new Exception();
}catch(Exception e)
{
System.out.println("catch");
}
finally{
System.out.println("finally");
}
}
}

Is This Answer Correct ?    3 Yes 0 No

what is the purpose of the final in the try-catch-final..

Answer / maha

That's not final,that one is finally, which is followed
after the try-catch block,It helps "garbage collection".

Is This Answer Correct ?    3 Yes 3 No

what is the purpose of the final in the try-catch-final..

Answer / srinivas

After executing try catch statements last statement is
finally it must execute in at anycase

Is This Answer Correct ?    0 Yes 0 No

what is the purpose of the final in the try-catch-final..

Answer / madhu

yes it correct it is finally,the use of finally is,if we
did not catch the exception in try/catch block also finnaly
will catch.

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More Core Java Interview Questions

whst is encapsulation?when u encpsulate actually while devoloping code?

7 Answers   Amdocs, MGL,


how to handle exceptions in ejb?

1 Answers   HCL,


What is Restrictions in hibernate?

1 Answers   Bally Technologies,


How we can run a jar file through command prompt in java?

0 Answers  


Will set allow duplicates in java?

0 Answers  






What is the difference between serial and throughput garbage collector?

0 Answers  


What is a map? What are the implementations of map?

0 Answers  


How can we create a object of a class without using new operator.

1 Answers   Infosys, Nokia,


Java support what type of parameter passing ?

7 Answers   Wipro,


how to print the below in java? * * * * * * * * *

2 Answers  


when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???

0 Answers   SAP Labs,


Why are the methods of the math class static?

0 Answers  


Categories