Java Software Engineer Question:

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

Tweet Share WhatsApp

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 PDF Read All 45 Java Software Engineer Questions
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?