What's wrong?
package com.codegym.task.task16.task1632;
import org.omg.PortableServer.THREAD_POLICY_ID;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Solution {
public static List<Thread> threads = new ArrayList<>(5);
static {
Thread one = new Thread() {
@Override
public void run() {
while (true) {}
}
};
Thread two = new Thread() {
@Override
public void run() {
if (isInterrupted()) {
try {
throw new InterruptedException();
} catch (InterruptedException e) {
System.out.println("InterruptedException");
}
}
}
};
Thread three = new Thread() {
@Override
public void run() {
while (true) {
try {
System.out.println("Hurray");
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
Thread four = new Thread4() {
@Override
public void run() {
while (!isInterrupted()) {}
}
};
Thread five = new Thread() {
@Override
public void run() {
Scanner console = new Scanner(System.in);
String line;
int sum = 0;
while (!(line = console.nextLine()).equals("N")) {
sum += Integer.parseInt(line);
}
System.out.println(sum);
}
};
threads.add(one);
threads.add(two);
threads.add(three);
threads.add(four);
threads.add(five);
}
public static void main(String[] args) {
}
public static class Thread4 extends Thread implements Message {
@Override
public void showWarning() {
this.interrupt();
}
}
}