Skip to content

Commit 0d695fa

Browse files
committed
lecture
1 parent 904e197 commit 0d695fa

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

src/main/java/io/concurrency/chapter02/exam01/AnonymousRunnableClassExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public static void main(String[] args) {
55

66
Thread thread = new Thread(new Runnable() {
77
public void run() {
8-
System.out.println("무명 Runnable 클래스에 의한 스레드 실행 중");
8+
System.out.println("스레드 실행 중");
99
}
1010
});
1111
thread.start();

src/main/java/io/concurrency/chapter02/exam01/AnonymousThreadClassExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public static void main(String[] args) {
55

66
Thread thread = new Thread(){
77
public void run() {
8-
System.out.println("무명 Thread 클래스에 의한 스레드 실행 중");
8+
System.out.println("스레드 실행 중");
99
}
1010
};
1111

src/main/java/io/concurrency/chapter02/exam01/ExtendThreadExample.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
public class ExtendThreadExample {
44
public static void main(String[] args) {
55

6-
MyThread thread = new MyThread();
7-
thread.start();
6+
MyThread thread1 = new MyThread();
7+
thread1.start();
8+
9+
MyThread thread2 = new MyThread();
10+
thread2.start();
811

912
// new MyThread().start();
1013
}
1114
}
1215
class MyThread extends Thread {
1316
public void run() {
14-
System.out.println("스레드 확장에 의한 실행 중");
17+
System.out.println(Thread.currentThread().getName()+ " :스레드 실행 중");
1518
}
1619
}

src/main/java/io/concurrency/chapter02/exam01/ImplementRunnableExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ public static void main(String[] args) {
1111

1212
class MyRunnable implements Runnable {
1313
public void run() {
14-
System.out.println("Runnable 구현에 의한 스레드 실행 중");
14+
System.out.println("스레드 실행 중");
1515
}
1616
}

src/main/java/io/concurrency/chapter02/exam01/LambdaThreadExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public class LambdaThreadExample {
44
public static void main(String[] args) {
55

6-
Thread thread = new Thread(() -> System.out.println("람다 표현식에 의한 스레드 실행 중"));
6+
Thread thread = new Thread(() -> System.out.println("스레드 실행 중"));
77

88
thread.start();
99
}

0 commit comments

Comments
 (0)