Does the thread itself create the removal and collection of garbage after it is launched, or does it continue to exist and consumes memory even after the run() method completes?
For instance:
Class A{ public void somemethod() { while(true) new ThreadClass().start(); } public class ThreadClass extends Thread{ public ThreadClass() {} @Override public void run() {......} } }
I want to clarify whether this thread will be automatically deleted from memory or should it be executed explicitly.
Aada source share