Не проходит валидацию , методы вызываются как надо ,но ….
package com.javarush.task.task15.task1519;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
/*
Разные методы для разных типов
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
while (true) {
String s = bufferedReader.readLine();
if (s.equals("exit")) {
break;
}
if (s.contains(".")) {
print(Double.valueOf(s));
} else {
try {
if (Integer.parseInt(s) > 0 && Integer.parseInt(s) < 128) {
print((short) Integer.parseInt(s));
} else
print(Integer.parseInt(s));
} catch (NumberFormatException e) {
print(s);
}
}
}
}
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);
}
}