1.

Which one of the following causes memory leak?(a) Release database connection when querying is complete(b) Use Finally block as much as possible(c) Release instances stored in static tables(d) Not using Finally block oftenThis question was posed to me in an interview for internship.My query is from Coding best practices topic in portion Autoboxing & Miscellaneous of Java

Answer» CORRECT option is (d) Not USING Finally block often

To EXPLAIN I would say: Finally block is called in successful as well exception SCENARIOS. HENCE, all the connections are closed properly which avoids memory leak.


Discussion

No Comment Found

Related InterviewSolutions