Java code for “implements Runnable”
===
import java.awt.*;
import java.applet.*;
/* <applet code=”applE6″ width=200 height=200> </applet> */
public class applE6 extends Applet implements Runnable
// cant have two classes
{
Thread t;
int x=100,y=100;
public void init() // method available under applet class
{
t=new Thread(this,”child thread”);
t.start();
}
public void run()
{
for (int i=0;i<=10;i++)
{
//repaint(); //calls the paint method
try
{
Thread.sleep(1000);}
catch(Exception ae)
{}
}
}
public void paint(Graphics g)
{
g.drawString(“Jimmy’s Value World”,x,y);
x+=50;
y+=50;
}
}