Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.test.level16.lesson03.task02;
- /* My second thread
- 1. Создать public static класс TestThread унаследовавшись от класса Thread.
- 2. Создать статик блок внутри TestThread, который выводит в консоль "it's static block inside TestThread".
- 3. Метод run должен выводить в консоль "it's run method".
- */
- 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 static block inside TestThread");
- }
- @Override
- public void run()
- {
- System.out.println("it's run method");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement