Eclipse提示在Class MyThread给出这样一句话,The type MyThread is already defined- package day12;
- public class Example03 {
- public static void main(String[] args){
- MyThread myThread=new MyThread();
- Thread thread=new Thread(myThread);
- thread.start();
- while(true){
- System.out.println("主函数在运行");
- }
- }
- }
- class MyThread implements Runnable{
- public void run(){
- while(true){
- System.out.println("线程在运行");
- }
- }
- }
复制代码
|
|