Class kk implements Runnable extends Thread This syntax is correct or not. Is it give any ambiguities in a program when we compile this? Which method override this?
NOTE : [I][This question was asked by Srivani][/I]
Printable View
Class kk implements Runnable extends Thread This syntax is correct or not. Is it give any ambiguities in a program when we compile this? Which method override this?
NOTE : [I][This question was asked by Srivani][/I]
hi jobhelper
there is not any ambiguity in this syntax and this compiles fine
here is the code.........
which displays "hi" ten times on the screen......
public class kk extends Thread implements Runnable
{
Thread th;
String name;
public kk()
{
name = "hi";
th = new Thread(this);
th.start();
}
public void run()
{
for(int i=0;i<10;i++)
{
try
{
sleep(1000);
}
catch(InterruptedException exr)
{
System.out.println(exr.getMessage());
}
System.out.println(name);
}
}
public static void main(String []ar)
{
new kk();
}
}