Advertisement
jaVer404

level16.lesson03.task02

Aug 13th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. package com.javarush.test.level16.lesson03.task02;
  2.  
  3. /* My second thread
  4. 1. Создать public static класс TestThread унаследовавшись от класса Thread.
  5. 2. Создать статик блок внутри TestThread, который выводит в консоль "it's static block inside TestThread".
  6. 3. Метод run должен выводить в консоль "it's run method".
  7. */
  8.  
  9. public class Solution {
  10.     public static void main(String[] args) {
  11.         TestThread thread = new TestThread();
  12.         thread.start();
  13.     }
  14.     public static class TestThread extends Thread {
  15.         static {
  16.             System.out.println("it's static block inside TestThread");
  17.         }
  18.  
  19.         @Override
  20.         public void run()
  21.         {
  22.             System.out.println("it's run method");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement