-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSolution.java
More file actions
62 lines (42 loc) · 1.78 KB
/
Solution.java
File metadata and controls
62 lines (42 loc) · 1.78 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
51
52
53
54
55
56
57
58
59
60
61
62
//I command these things to you, that you may love one another. (John 15:17)
package com.javarush.task.task16.task1602;
/*
My second thread
*/
public class Solution {
public static void main(String[] args) {
TestThread thread = new TestThread();
thread.start();
}
public static class TestThread extends Thread {
static{
System.out.println("it's a static block inside TestThread");
}
public void run() {
System.out.println("it's a run method");
}
}
}
/*
My second thread
1. Создать public static класс TestThread, унаследованный от класса Thread.
2. Создать статик блок внутри TestThread, который выводит в консоль «it's a static block inside TestThread«.
3. Метод run должен выводить в консоль «it's a run method«.
Требования:
1. Добавь в класс Solution публичный статический класс TestThread.
2. Класс TestThread должен быть унаследован от класса Thread.
3. Класс TestThread не должен реализовывать какие-либо дополнительные интерфейсов.
4. Создать статик блок внутри TestThread, который выводит в консоль "it's a static block inside TestThread".
5. Метод run класса TestThread должен выводить "it's a run method".
6. Метод main не изменять.
package com.javarush.task.task16.task1602;
*
My second thread
*
public class Solution {
public static void main(String[] args) {
TestThread thread = new TestThread();
thread.start();
}
}
*/