class daem
{
public static void main (String arg[])
{
First f = new First();
if(f.isDaemon())
{
System.out.println("this is Daemon thread");
}
else
{
System.out.println("this is a not daemon thread");
}
f.setDaemon(true);
if(f.isDaemon())
{
System.out.println("this is Daemon thread");
}
else
{
System.out.println("this is a not daemon thread");
}
f.setDaemon(false);
f.start();
}
}
class First extends Thread
{
public void run()
{
System.out.println("begin first thread");
for(int i=0; i<3;i++)
{
System.out.println("i="+i);
}
System.out.println("over thread");
}
}
0 comments:
Post a Comment
Let us know your responses and feedback