Как это????
package com.javarush.task.task16.task1632;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Solution {
public static List<Thread> threads = new ArrayList<>(5);
static{
threads.add(new Thread(new Thread1()));
threads.add(new Thread(new Thread2()));
threads.add(new Thread(new Thread3()));
threads.add(new Thread(new Thread4()));
threads.add(new Thread(new Thread5()));
}
public static void main(String[] args) {
}
public static class Thread1 implements Runnable{
public void run(){
while(true){
}
}
}
public static class Thread2 implements Runnable{
public void run(){
try{
throw new InterruptedException();
}catch(InterruptedException e){
System.out.println("InterruptedException");
}
}
}
public static class Thread3 implements Runnable{
public void run(){
while(true){
try {
System.out.println("Ура");
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
public static class Thread4 extends Thread implements Message{
public void run(){
while(!isTrue){
System.out.println("Tik");
}
}
public void showWarning() {
this.isTrue = true;
}private boolean isTrue = false;
}
public static class Thread5 implements Runnable{
public void run(){
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int count = 0;
try {
while(true) {
String s = reader.readLine();
if(s.equals("N")){
break;
}
int number = Integer.parseInt(s);
count += number;
}
System.out.println(count);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}