Добрый день,
Помогите с пунктом 4, обьясните что не так.
Видно я в обучении то-то упустил...
package com.javarush.task.task16.task1632;
import javax.annotation.processing.Messager;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import com.javarush.task.task16.task1632.Message;
/*
Клубок
*/
public class Solution {
public static List<Thread> threads = new ArrayList<>(5);
static{
threads.add(new Thread(new CicleThred()));
threads.add(new Thread((new InterrupderThread())));
threads.add(new Thread(new UraThread()));
threads.add(new Thread(new MessageThread()));
threads.add(new Thread(new CalculadeThread()));
}
public static void main(String[] args) {
}
public static class CicleThred implements Runnable{
boolean ring = true;
int a = 0;
@Override
public void run() {
while(ring = true){
a=+a;
}
}
}
public static class InterrupderThread implements Runnable {
boolean ring = true;
int a = 0;
@Override
public void run() {
try {
Thread.sleep(100);
} catch(InterruptedException e){
System.out.println("InterruptedException");
}
}
}
public static class UraThread implements Runnable{
@Override
public void run() {
while(true){
System.out.println("Ура");
try{
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
public static class MessageThread implements Runnable, Message {
Thread ShowWarning = new Message();
@Override
public void showWarning() {
while (ShowWarning.isAlive()){
Thread.currentThread().interrupt();
}
}
@Override
public void run() {
}
}
public static class CalculadeThread implements Runnable {
@Override
public void run(){
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int i =0;
int sum = 0;
while(true) {
try {
i = Integer.parseInt(reader.readLine());
sum +=i;
} catch (NumberFormatException | IOException e) {
System.out.println(sum);
}
}
}
}
}