class a
{
public static void main(String [] args)
{
MyThread th=new MyThread();
th.start();
System.out.println(Thread.currentThread().getName());
}
}
class MyThread extends Thread
{
public void run()
{
System.out.println("new Thread start");
}
}和
class a
{
public static void main(String [] args)
{
MyThread th=new MyThread();
th.start();
System.out.println("121");
}
}
class MyThread extends Thread
{
public void run()
{
System.out.println("new Thread start");
}
}
为什么两个线程执行顺序不一样?只是改变了println里的
{
public static void main(String [] args)
{
MyThread th=new MyThread();
th.start();
System.out.println(Thread.currentThread().getName());
}
}
class MyThread extends Thread
{
public void run()
{
System.out.println("new Thread start");
}
}和
class a
{
public static void main(String [] args)
{
MyThread th=new MyThread();
th.start();
System.out.println("121");
}
}
class MyThread extends Thread
{
public void run()
{
System.out.println("new Thread start");
}
}
为什么两个线程执行顺序不一样?只是改变了println里的
解决方案 »
- java对象中的主类型元素存在哪里,是否和main函数中的主类型变量一样存在堆栈中,还是作为对象的一部分存在堆中?
- 读取txt文件显示在表格中
- net.sourceforge.jtds.jdbc.Driver 问题
- [入门级]final int[] p;是不是说p是个常引用(指针)?
- 文件操作问题
- 有关求最大的两个数值的问题
- 怎么往JTable中添加一列,为JTextArea?而且JTextArea中的内容。。。
- 关于即时通信消息提示的问题
- 急,一个聊天室程序,为什么两者不能建立连接?
- 我想学习JAVA,请高手们指点一下如何掌握这块儿肥肉?
- 哪里有专门讲java中数据库组件的书或者资料啊
- 请问swing 程序如何读xml文件
这个谁先谁后还是不确定的
我测试下来顺序就是一样的
start之后并不是立即执行的