Ktoś wytłumaczy dlaczego nie spełniam ostatniego testu?
package pl.codegym.task.task15.task1519;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Różne metody dla różnych typów
*/
public class Solution {
public static void main(String[] args) throws IOException {
//tutaj wpisz swój kod
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
while (true) {
String inputString = bufferedReader.readLine();
if (inputString.equals("exit")) {
break;
} else if (inputString.contains(".")) {
try {
Double d = Double.parseDouble(inputString);
print(d);
} catch (NumberFormatException e) {
print(inputString);
}
}
try {
Integer i = Integer.parseInt(inputString);
if (i > 0 && i < 128) {
Short s = Short.valueOf(String.valueOf(i));
print(s);
} else {
print(i);
}
} catch (NumberFormatException e) {
print(inputString);
}
}
}
public static void print(Double value) {
System.out.println("To jest Double. Value: " + value);
}
public static void print(String value) {
System.out.println("To jest String. Value: " + value);
}
public static void print(short value) {
System.out.println("To jest liczba całkowita typu short. Value: " + value);
}
public static void print(Integer value) {
System.out.println("To jest liczba całkowita typu Integer. Value: " + value);
}
}