-1

This question was asked in an interview for the Senior Developer Role. As I don't have any exposure to Java multi-threading and concurrency. So, I could not answer this.

Every thread we create is part of a ThreadGroup. Then how do we create a thread without ThreadGroup?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Sitaram P
  • 7
  • 3
  • It is off-topic to ask about external resources, so I edited out that part of your question. – talex Jul 24 '21 at 08:41

1 Answers1

3

It is not possible to create a thread without ThreadGroup.

For more details look here: https://www.eg.bucknell.edu/~mead/Java-tutorial/essential/threads/group.html

"If you create a new Thread without specifying its group in the constructor, the runtime system automatically places the new thread in the same group as the thread that created it (known as the current thread group and the current thread, respectively). So, if you leave the thread group unspecified when you create your thread, what group contains your thread?

When a Java application first starts up, the Java runtime system creates a ThreadGroup named main. Unless specified otherwise, all new threads that you create become members of the main thread group."

And here: http://www.java2s.com/example/java-book/thread-group.html

zitrusire2520
  • 180
  • 2
  • 11