Java Software Engineer Question:

Download Job Interview Questions and Answers PDF

Explain me what is a good usecase of calling System.gc()?

Java Software Engineer Interview Question
Java Software Engineer Interview Question

Answer:

One may call System.gc() when profiling an application to search for possible memory leaks. All the profilers call this method just before taking a memory snapshot.

Download Java Software Engineer Interview Questions And Answers PDF

Previous QuestionNext Question
Do you know how threadsafe is enum in Java?Explain me why doesn’t the following code generate a NullPointerException even when the instance is null?