package TestException;
public class test5 {
public static void main(String[] args) {
Test6 s1 = new Test6("张三"); Test6 s2= new Test6("撒"); //实现Runnable接口,执行多线程的实例 格式:new Thread(参数).start(); new Thread(s1).start(); new Thread(s2).start();}
}
class Test6 implements Runnable{ private String name; @Override public void run() { show(); } public void show(){ for(int i=0;i<10;i++){ System.out.println(name+i); } } Test6(String name){ this.name=name; }}