What will happen if we cannot mention "finally" in Java
Program ???

Answer Posted / dhruva

finally must be used while dealing with I/O like,
file,stream and reader, etc.
in finally block, we r closing I/O objects in LIFO way to
avoid curruption of I/O during GC process and also, after
one I/O related program finish execution - just for the
sake of flushing for next use in better way

Is This Answer Correct ?    7 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is string literal in java?

543


What is meant by interface?

553


How do you calculate square roots?

558


How do you start a thread?

534


Explain the difference between serializable and externalizable in java?

519






Are static members inherited to sub classes?

626


Why put method is idempotent?

448


What is the same as procedures?

523


What are heap memory and stack memory and what are memory tables.

494


What is annotation in java?

563


What is meant by overloading?

574


How do you sort arraylist in descending order?

564


What is the lifetime and scope of a variable?

505


Can we override private method?

543


What are loops in java?

535