Все выводит корректно, с shot и Double вывод кореектный,а с Integer и String просто выводит ввод, без подписи.
package com.javarush.task.task15.task1519;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Разные методы для разных типов
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String input;
boolean isTrue = true;
while (isTrue){
input = reader.readLine();
if(input.equals("exit")) {
isTrue = false;
break;
}
try {
Double tmpDouble = Double.parseDouble(input);
if (input.contains(".")){
print(tmpDouble);
}
Integer tmpInteger = Integer.parseInt(input);
if (tmpInteger > 128 && tmpInteger < 0) {
System.out.println((int)tmpInteger);
}
else if (tmpInteger < 128 && tmpInteger > 0){
print(Short.parseShort(input));
}
}
catch (Exception e){
System.out.println(input);}
//напиште тут ваш код
}}
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);
}
}