package example.text;public class ThreadTextDemo {
public static void main(String[]args)
{
TestThread a=new TestThread();
new Thread(a).start();
for(int b=0;b<5;b++)
{
System.out.println("1");
}
}}
class TestThread implements Runnable {
public void run(){
for(int a=0;a<5;a++){
System.out.println("2");
}
}
public void talk()
{
System.out.println("3");
}
}
输出:1111122222 为什么没创建起线程1212121212输出。
public static void main(String[]args)
{
TestThread a=new TestThread();
new Thread(a).start();
for(int b=0;b<5;b++)
{
System.out.println("1");
}
}}
class TestThread implements Runnable {
public void run(){
for(int a=0;a<5;a++){
System.out.println("2");
}
}
public void talk()
{
System.out.println("3");
}
}
输出:1111122222 为什么没创建起线程1212121212输出。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货