class MyThread extends Thread
{
MyThread()
{
System.out.print(" MyThread");
}
public void run()
{
System.out.print(" bar");
}
public void run(String s)
{
System.out.println(" baz");
}
}
public class TestThreads
{
public static void main (String [] args)
{
Thread t = new MyThread()
{
public void run()
{
System.out.println(" foo");
}
};
t.start();
}
}
您好,我是 java 新手,目前正在学习多线程,当我运行上述程序时,我得到了这个特定的输出MyThread foo请解释为什么?