Почему не могу пройти даже 2-ой пункт условия?
package com.javarush.task.task15.task1519;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
/*
Разные методы для разных типов
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while(!reader.readLine().equals("exit")){
try {
String key = reader.readLine();
int key2 = Integer.parseInt(key);
if(key.contains("."))
print(Double.parseDouble(key));
else if((key2 > 0) && (key2 < 128)) {
print(Short.parseShort(key));
}
else if((key2 <= 0) || (key2 >= 128)){
print(key2);
}
else{
print(key);
}
}
catch (NullPointerException n){
System.out.println("Ошибка");
}
}
}
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);
}
}