1、第一首先在电脑上点击打开eclipse软件。然后创建MyThread对象和线程对象。代码:MyThread mt=new MyThread();Thread t=new Thread(mt);
2、第二然后再开启线程。代码:t.start();
3、第三然后在线程的后面加入无限循环的代码。代码:while(true){System.out.println("mian()方法在运行");}
4、第四然后再创建一个新类MyThread继承Runnable。代码:class MyThread implements Runnable{}。
5、第五然后再创建run方法。代码:public void run(){}
6、第六然后在run的方法中,再加入一个无限的循环的代码。代码:while(true){System.out.println("MyTread类的run()在运行");}