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
What's the access scope of protected access specifier?
When do you get classcastexception?
What is thread life cycle?
Write a java program to find the route that connects between Red and Green Cells. General Rules for traversal 1. You can traverse from one cell to another vertically, horizontally or diagonally. 2. You cannot traverse through Black cells. 3. There should be only one Red and Green cell and at least one of each should be present. Otherwise the array is invalid. 4. You cannot revisit a cell that you have already traversed. 5. The maze need not be in the same as given in the above example
Where and how can you use a private constructor?
Is singleton set an interval?
Can we have 2 main methods in java class?
What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
Is java programming easy?
Is null == null in java?
What is the difference between procedural and object-oriented programs?
Can we overload the main() method?
Explain the purpose of garbage collection in Java?
What modifiers are allowed for methods in an interface?
Explain the difference between treeset and treemap in java?