Загрузка...

#4 Mastering Java Garbage Collection Explicit vs Implicit Calls

Now my question is Who called the garbage collector Garbage collector is implicitly called by JVM after some time interval Now next question is can we explicitly call the garbage collector Yes A programmer can able to call the garbage collector in Java by a method of a static method of a system class You know that uh why we call the garbage collector Garbage collector is called to plus the unused object Now the question is uh who called the garbage collector You tell that garbage collector is implicitly called by JVM or automatically called by JVM after some time interval Can we explicitly call it Yes We can explicitly call it uh by the predefined static method available in which class System class A runtime class case there is another method is there sorry In a runtime class also there is a method is there Runtime is another class present in world uh java same-lang package Runtime is a singleton class Singleton means world In runtime class we are able to create only one object So in this case system class case how can you call System gc As it is a static method we call it by class name Check here that is a system gc Runtime class having a non-static method public void that is gc You have to call like this public void gc Now see it is the method offered uh runtime class It is a non-static method But how we call it uh they go that is uh runtime dot uh that is uh getRuntime dot uh that is which method That is gc Dot gc That is uh what I can do here sorry here you see dot gc Check uh this is the way we can call the garbage collector explicitly

Видео #4 Mastering Java Garbage Collection Explicit vs Implicit Calls канала Java Technocrat
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки