Прошу помощи, застрял с 4 и 5 пунктами.
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 C1()));
threads.add(new Thread(new C2()));
threads.add(new Thread(new C3()));
threads.add(new Thread(new C4()));
threads.add(new Thread(new C5()));
}
public static void main(String[] args) {
}
public static class C1 implements Runnable {
@Override
public void run() {
while (true) {
}
}
}
public static class C2 implements Runnable {
@Override
public void run() {
try {
while (true) {
Thread.sleep(111);
}
} catch (InterruptedException e) {
System.out.println("InterruptedException");
}
}
}
public static class C3 implements Runnable {
@Override
public void run() {
try {
while (true) {
System.out.println("Ура");
Thread.sleep(500);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public static class C4 implements Message, Runnable {
@Override
public void run() {
while (Thread.currentThread().isAlive()) {
}
}
@Override
public void showWarning() {
Thread.currentThread().interrupt();
}
}
public static class C5 implements Runnable {
String s = null;
int sum = 0;
@Override
public void run() {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {
while (true) {
s = reader.readLine();
if (s.equals("N")) {
System.out.println(sum);
break;
}
sum += sum + Integer.parseInt(s);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}