Often I create Child threads within the main() as
Thread thread = new Thread(new Runnable(){public void run(){}});
Likewise, is it also possible to create parent threads ?
Often I create Child threads within the main() as
Thread thread = new Thread(new Runnable(){public void run(){}});
Likewise, is it also possible to create parent threads ?
Runtime.exec()
?
see: How to create a process in Java
I think we're really not sure what you mean by "parent thread" though...
From coderanch.com: http://www.coderanch.com/t/475322/threads/java/Parent-thread-id
Except for the thread which is created by the JVM to start the application, every thread is created by some other thread. You have decided to call this the "parent thread"; that isn't a concept of the Java language, though.
main() is the parent thread......
Try this....
public static void main(String[] args)
{
System.out.println(Thead.currentThead().getName());
}