Looks completely fine by my eyes.. any ideas?package com.codegym.task.task15.task1519;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
/*
Different methods for different types
*/
public class Solution {
public static void main(String[] args) throws IOException {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while (true) {
String str = reader.readLine();
if (str.equals("exit")) {
break;
}
try {
if (str.contains("."))
print(Double.parseDouble(str));
else if (Short.parseShort(str) > 0 && Short.parseShort(str) < 128)
print(Short.parseShort(str));
else if (Integer.parseInt(str) <= 0 || Integer.parseInt(str) >= 128)
print(Integer.parseInt(str));
} catch (NumberFormatException e) {
print(str);
}
}
}
public static void print(Double value) {
System.out.println("This is a Double. Value: " + value);
}
public static void print(String value) {
System.out.println("This is a String. Value: " + value);
}
public static void print(short value) {
System.out.println("This is a short. Value: " + value);
}
public static void print(Integer value) {
System.out.println("This is an Integer. Value: " + value);
}
}