构造:
public class MyRunnable implements Runnable {
@Override
public void run(){
for (int i=0;i<100;i++){
System.out.println("MyRunnable is start"+i);
}
}
}
测试:
public class TestMyrunnable {
public static void main(String[] args) {
MyRunnable myRunnable=new MyRunnable();
Thread thread=new Thread(myRunnable);
thread.start();
}
}
结果: