What will happen when you attempt to compile and run the following code?class MyThread extends Thread
{
public void run()
{
System.out.println("MyThread: run()");
} public void start()
{
System.out.println("MyThread: start()");
}
}class MyRunnable implements Runnable
{
public void run()
{
System.out.println("MyRunnable: run()");
} public void start()
{
System.out.println("MyRunnable: start()");
}
}public class MyTest 
{
public static void main(String args[])
{
MyThread myThread  =  new MyThread();
MyRunnable myRunnable = new MyRunnable();
Thread thread  =  new Thread(myRunnable);
myThread.start();
thread.start();
}
}大家认为怎么输出?为什么,理由要详细一点哦

解决方案 »

  1.   

    MyThread myThread  =  new MyThread();
    MyRunnable myRunnable = new MyRunnable();
    Thread thread  =  new Thread(myRunnable);
    myThread.start();
    thread.start();
    首先创建两个实现了了start 和run方法的类的实例对象.
    调用THREAD的构造方法,传进去了一个实现了run方法的对象.
    剩下两个start 都是他重新写的方法,不是调用了开启多线成的东西.我就知道这些,不知道对不对.
      

  2.   

    MyThread: start()
    MyRunnable: start()应该是这个吧,覆盖了原来的线程类里的方法了
      

  3.   

    为什么一个就覆盖了,一个却没有,还是调用run方法