看不懂为什么运行结果为BAB ?
难道不是函数和t抢资源吗?作者: 潘星 时间: 2012-8-10 00:16
public class ThreadTest {
public static void main(String args[]) {
MyThread t = new MyThread();
t.run(); 1.你这里调用的是run()方法,并没有开启线程,而是主函数在运行run()方法中的内容
public class A {
public static void main(String args[]) {
MyThread t = new MyThread();
t.run();//你这里调用了MyTread对象的run()方法,是把run()方法单做一个普通的方法
//调用的,这跟MyTread是不是继承了Thread没有关系,就是普通的方法调用
//所以就先打印了run()方法的打印语句里的B