- class compute implements Runnable
- {
- int i = 0;
- public void run()
- {
- for(int i = 0; i < 10; i++)
- {
- System.out.println("this:"+i);
- }
- }
- }
- class compute1 implements Runnable
- {
- public void run()
- {
- for(int i = 0; i < 10; i++)
- {
- System.out.println(i);
- }
- }
- }
- class threadtest
- {
- public static void main(String[] args)
- {
- compute c = new compute();
- compute1 c1 = new compute1();
-
- Thread t = new Thread(c);
- Thread t1 = new Thread(c1);
- t.start();
- t1.start();
- System.out.println("Hello World!");
- }
- }
复制代码 编译的时候为什么会出现找不到符号,Thread t1 = new Thread(compute)的错误,我两个类都实现Runnable接口了啊
|
|