When I say something like:
Thread t1 = new Thread();
does it create it on a heap or a stack?
There is no way to allocate objects on the stack in Java. The stack can only hold references and primitives, and only for local variables.
Note that starting a thread will create a new stack for that thread.
2.1m questions
2.1m answers
60 comments
57.0k users