Почитал комменты, вроде все ок,валидатор не принимает
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 {
FourthThread t4 = new FourthThread();
threads.add(new Thread(new Thread1()));
threads.add(new Thread(new Thread2()));
threads.add(new Thread(new Thread3()));
threads.add(t4);
threads.add(new Thread(new Thread5()));
}
public static void main(String[] args) {
Thread tt5 = threads.get(4);
tt5.start();
}
public static class Thread1 implements Runnable {
public void run() {
while(true) {
}
}
}
public static class Thread2 implements Runnable {
public void run() {
try {
while (true) {
Thread.sleep(20);
}
} 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) {}
}
}
}
public static class FourthThread extends Thread implements Message {
public void run() {
while (!isInterrupted()) {}
}
@Override
public void showWarning() {
interrupt();
}
}
public static class Thread5 implements Runnable {
public void run() {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> sum = new ArrayList<>();
int sum1 = 0;
try {
while (true) {
String s = reader.readLine();
if (s.equals("N")) {
break;
} else {
int n = Integer.parseInt(reader.readLine());
sum.add(n);
}
}
} catch (IOException e) {}
for (int x = 0; x < sum.size(); x++) {
sum1 += sum.get(x);
}
System.out.println(sum1);
}
}
}