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 class thread1 extends Thread {
@Override
public void run() {
while (1 > 0) {
}
}
}
public static class thread2 extends Thread {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
System.out.println("InterruptedException");
}
}
}
}
public static class thread3 extends Thread {
@Override
public void run() {
for (int i = 0; i < 100; i++) {
try {
System.out.println("Ура");
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
public static class thread4 extends Thread implements Message {
boolean b = true;
@Override
public void run() {
while (b != false) {
}
}
@Override
public void showWarning() {
b = false;
}
}
public static class thread5 extends Thread {
public thread5() throws IOException {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
String point = read.readLine();
int x = 0;
while (true) {
if (!point.equals("N")) {
Integer i = Integer.parseInt(point);
x = i + x;
point = read.readLine();
} else break;
}
System.out.println(x);
}
}
public static List<Thread> threads = new ArrayList<>(5);
static {
thread1 thread1 = new thread1();
thread2 thread2 = new thread2();
thread3 thread3 = new thread3();
thread4 thread4 = new thread4();
thread5 thread5 = null;
try {
thread5 = new thread5();
} catch (Exception e) {
e.printStackTrace();
}
threads.add(thread1);
threads.add(thread2);
threads.add(thread3);
threads.add(thread4);
threads.add(thread5);
}
public static void main(String[] args) {
}
}package com.javarush.task.task16.task1632;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test {
public static void main(String[] args) throws IOException {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
String point = read.readLine();
int x = 0;
while (true) {
if(!point.equals("N")){
Integer i = Integer.parseInt(point);
x = i + x;
point = read.readLine();
}
else break;
}
System.out.println(x);
}
}