forked from PacktPublishing/Java-Coding-Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNewThread.java
More file actions
28 lines (22 loc) · 733 Bytes
/
NewThread.java
File metadata and controls
28 lines (22 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package modern.challenge;
public class NewThread {
public void newThread() {
Thread t1 = new Thread(() -> {
});
System.out.println("NewThread t1: " + t1.getState());
Runnable runnable1 = () -> {
};
Thread t2 = new Thread(runnable1);
System.out.println("NewThread t2: " + t2.getState());
Thread t3 = new Thread(new Runnable() {
public void run() {
}
});
System.out.println("NewThread t3: " + t3.getState());
Thread t4 = new Thread(new Thread() {
public void run() {
}
});
System.out.println("NewThread t4: " + t4.getState() + "\n");
}
}