我在
ttt.start(); //语句A
ttt.xxx(); //语句B
之间加了sleep让出cpu,这样新建的Thread在这段时间就真正执行了。
class TestThread3 extends Thread {
public void run() {
System.out.println("Running");
System.out.println("Done");
} private void xxx() {
System.out.println("In xxx");
} public static void main(String args[]) {
TestThread3 ttt = new TestThread3(); ttt.start(); //语句A try { //look here
Thread.sleep(1000);
}catch (InterruptedException e){
} ttt.xxx(); //语句B
}
}
ttt.start(); //语句A
ttt.xxx(); //语句B
之间加了sleep让出cpu,这样新建的Thread在这段时间就真正执行了。
class TestThread3 extends Thread {
public void run() {
System.out.println("Running");
System.out.println("Done");
} private void xxx() {
System.out.println("In xxx");
} public static void main(String args[]) {
TestThread3 ttt = new TestThread3(); ttt.start(); //语句A try { //look here
Thread.sleep(1000);
}catch (InterruptedException e){
} ttt.xxx(); //语句B
}
}
解决方案 »
- java开发问题
- instanceof是哪个类里定义的。
- help!!!!有一txt文件放在jar中,txt文件的内容: 078060*078058*078060*078058*078060*,请写出程序读取出78 、60、78、58……这样的数字。(10分)
- 求段代码或思路。
- [求助 急!!!!!!!!]使用HttpURLConnection 模拟multipart/form-data发送文件?格式是什么?
- 请问这段代码错在哪儿啊?代码很短,麻烦高手们看一看!谢谢
- 江湖告急!为什么在jbuilder中的能运行很好的applet在浏览器里无法运行!谢谢!
- 我们公司要做一个管理系统,请大家进来和我一起探讨。
- 有什么JBuilder的好书啊?推荐一下啦~
- Tomcat4.0的数据库连接池的大讨论(要求连接Oracle数据库),能解决另有高分给
- scjp考题一道!!!!!!!!
- static问题???
所以结果是...
http://www.csdn.net/expert/topic/437/437572.shtm吗?谢谢了