Всё выводит правильно, но -1 пропускает, не вижу проблем.
Помогите пожалуйста разобраться.
package com.javarush.task.task15.task1519;
import java.io.*;
/*
Разные методы для разных типов
*/
public class Solution {
public static void main(String[] args) throws IOException {
//напиште тут ваш код
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while (true) {
String str = reader.readLine();
try {
if (str.equals("exit")) {
break;
}
int i = Integer.parseInt(str);
if ((i > 0) && (i < 128)) {
print((short) i);
}
else
if ((i < 1) && (i > 127)) {
print(i);
}
}
catch (Exception name) {
try {
double d = Double.parseDouble(str);
print(d);
}
catch (Exception e) {
print(str);
}
}
}
}
public static void print(Double value) {
System.out.println("Это тип Double, значение " + value);
}
public static void print(String value) {
System.out.println("Это тип String, значение " + value);
}
public static void print(short value) {
System.out.println("Это тип short, значение " + value);
}
public static void print(Integer value) {
System.out.println("Это тип Integer, значение " + value);
}
}