Advertisement
jaVer404

level16.lesson03.task03

Aug 13th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. package com.javarush.test.level16.lesson03.task03;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. /* Список и нити
  7. В методе main добавить в статический объект list
  8.     5 нитей SpecialThread - различных объектов.
  9. */
  10.  
  11. public class Solution {
  12.     public static volatile List<Thread> list = new ArrayList<Thread>(5);
  13.  
  14.     public static void main(String[] args) {
  15.         //Add your code here - добавьте свой код тут
  16.         for (int i = 0; i < 5; i++) {
  17.          list.add(new Thread(new SpecialThread()));
  18.         }
  19.     }
  20.  
  21.     public static class SpecialThread implements Runnable  {
  22.         public void run() {
  23.             System.out.println("it's run method inside SpecialThread");
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement