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.
1.4m articles
1.4m replys
5 comments
56.9k users