need hint
package com.codegym.task.task16.task1632;
import java.awt.*;
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 BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
static {
klasa1 kl = new klasa1();
klasa2 k2 = new klasa2();
klasa3 k3 = new klasa3();
klasa4 k4 = new klasa4();
klasa5 k5 = new klasa5();
Thread first = new Thread(kl);
threads.add(first);
Thread second = new Thread(k2);
threads.add(second);
Thread third = new Thread(k3);
threads.add(third);
Thread fourth = new Thread(k4);
threads.add(fourth);
Thread fifth = new Thread(k5);
threads.add(fifth);
}
public static void main(String[] args) {
for (Thread t: threads) {
t.start();
}
}
public static class klasa1 extends Thread{
@Override
public void run() {
while(!cancelled){
System.out.println();
}
}
public volatile boolean cancelled = true;
public boolean iscancelled(){
return cancelled;
}
}
public static class klasa2 extends Thread{
@Override
public void run() {
System.out.println("InterruptedException");
}
}
public static class klasa3 extends Thread{
@Override
public void run() {
try{
while(!cancelled) {
System.out.println();
Thread.sleep(500);
}}
catch (Exception e){
}
}
public volatile boolean cancelled = true;
}
public static class klasa4 extends Thread implements Message{
@Override
public void showWarning() {
interrupt();
}
}
public static class klasa5 extends Thread{
@Override
public void run() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String a = reader.readLine();
int num = Integer.parseInt(a);
if(a.equals("N")){
System.out.println(num);
}
num += num;
}
catch (Exception e){
}
}
}
}