62,624
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package exp1;
/**
*
* @author szhu5
*/
public class TestThread
{
public static void main(String [] args)
{
Runner1 r1 = new Runner1();
Thread td = new Thread(r1);
td.start();
for (int j = 1; j < 100 ;j++ )
{
System.out.println("Thread :" + j);
}
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package exp1;
/**
*
* @author szhu5
*/
public class Runner1 implements Runnable
{
public void run ()
{
for (int i = 0; i <100 ;i++ )
{
System.out.println("runner1:" + i);
}
}
}
public class TestThread {
public static void main(String[] args) {
Runner1 r1 = new TestThread().new Runner1();
Thread td = new Thread(r1);
td.start();
for (int j = 1; j < 100; j++) {
System.out.println("Thread :" + j);
}
}
class Runner1 implements Runnable {
public void run() {
for (int i = 0; i < 100; i++) {
System.out.println("runner1:" + i);
}
}
}
}
public class TestThread {
public void test() {
Runner1 r1 = new Runner1();
Thread td = new Thread(r1);
td.start();
for (int j = 1; j < 100; j++) {
System.out.println("Thread :" + j);
}
}
public static void main(String[] args) {
TestThread testThread = new TestThread();
testThread.test();
}
class Runner1 implements Runnable {
public void run() {
for (int i = 0; i < 100; i++) {
System.out.println("runner1:" + i);
}
}
}
}