Code:
class MainClass{
public static void main(String a[]){
//do something
}
}
Thread ends and process ends.
I went through a link there i read about daemon thread.
"a daemon thread is one which won't prevent the program from ending." Basically it means main program/main thread.
Code:
class HelloThread extends Thread
{
public void run()
{ try{
for ( ; ; )
{
System.out.println("hello");
sleep(1000);
} }catch(Exception e){}
}
}
public class ThreadTest
{
public static void main(String[] args) throws Exception
{
Thread hello = new HelloThread();
hello.start();
System.out.println("Sorry, I must be leaving");
}
}
Comment