Ругается валидатор
package com.javarush.task.task15.task1519;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
/*
Разные методы для разных типов
*/
public class Solution {
public static boolean isNumeric(String str) {
return str.matches("-?\\d+(\\.\\d+)?"); //match a number with optional '-' and decimal.
}
public static void main(String[] args) throws IOException {
//напиште тут ваш код
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String read;
while (true) {
read = reader.readLine();
if (read.equals("exit")) break;
try {
if (read.contains(".")) {
print(Double.parseDouble(read));
} else if (Short.parseShort(read) > 0 && Short.parseShort(read) < 128) {
print(Short.parseShort(read));
} else if (Integer.parseInt(read) <= 0 || Integer.parseInt(read) >= 128) {
print(Integer.parseInt(read));
}
} catch (NumberFormatException e){
print(read);
}
}
}
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);
}
}