-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSolution.java
More file actions
50 lines (36 loc) · 1.4 KB
/
Solution.java
File metadata and controls
50 lines (36 loc) · 1.4 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//You didn't choose me, but I chose you, and appointed you, that you should go and bear fruit,
//and that your fruit should remain; that whatever you will ask of the Father in my name, he may give it to you. (John 15:16)
package com.javarush.task.task16.task1601;
/*
My first thread
*/
public class Solution {
public static void main(String[] args) {
TestThread task = new TestThread();
new Thread(task).start();
}
public static class TestThread implements Runnable {
public void run() {System.out.println("My first thread");}
}
}
/*
My first thread
Создать public static class TestThread — нить с интерфейсом Runnable.
TestThread должен выводить в консоль «My first thread«.
Требования:
1. Добавь в класс Solution публичный статический класс TestThread.
2. Класс TestThread должен реализовывать интерфейс Runnable.
3. Метод run класса TestThread должен выводить "My first thread".
4. Программа должна вывести "My first thread".
5. Метод main не изменять.
package com.javarush.task.task16.task1601;
/*
My first thread
*/
public class Solution {
public static void main(String[] args) {
TestThread task = new TestThread();
new Thread(task).start();
}
}
*/