package first;
import org.junit.Test;
public class MyFirstJava8 {
@Test
public void 기존쓰레드생성() {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
System.out.println("Hello!!");
}
});
thread.start();
}
@Test
public void lamda표현식이용쓰레드생성() {
Runnable runnable = () -> hello();
Thread t = new Thread(runnable);
t.start();
}
@Test
public void 쓰레드한줄로생성해보자() {
new Thread(() -> hello()).start();
}
public void hello() {
System.out.println("Hello1");
System.out.println("Hello2");
}
}