@Override
public void run() {
// TODO Auto-generated method stub
for (int i = 0; i < 10; i++) {
System.out.println("你好! 我是继承类 Thread的线程");
}
}
public static void main(String[] args) {
new ThreadDome().start();
new Thread(new Runnableimpl()).start();
Runnable run=()->{
for (int i = 0; i < 10; i++) {
System.out.println("你好! 我是lambada表达式的线程");
}
};
new Thread(run).start();
}
}
class Runnableimpl implements Runnable{
@Override
public void run() {
// TODO Auto-generated method stub
for (int i = 0; i < 10; i++) {
System.out.println("你好! 我是实现Runnable的线程");
}
}