Can we call garbage collector forcefully in Java?

Your thoughts?

|

Yes but this is NOT recommended...

Garbage collection in Java is non-deterministic. This means you never really know when GC is going to run in Java.

Remember that GC is an automatic process. It kind of does it's own thing and runs on it's own threads. Java is designed for you not to be manually managing memory...

|

yes

System.gc()

That is all...

|
System.gc();
Runtime.getRuntime.gc();
|

YES