class WatchDog implements Runnable
{
public WatchDog(Runnable r, int ms)
{
Thread t = new Thread(r);
t.start();
try
{
Thread.sleep(ms);
}
catch (InterruptedException e)
{
}
t.stop();
}
}
public class KillThread
{
public static void main(String[] args)
{
Analysis a = new Analysis();
WatchDog w = new WatchDog(a, 1000);
}
}
class Analysis implements Runnable
{
public void run()
{
while (true)
{
System.out.println("analyze ");
}
}
}





i have got this code from a site when i was studying about threads. this gives a bunch of compile errors which i was unable to fix. would somebody mind fixing it for me and explain ??