My code works excellent, I`v tried everything. Why it does not passing validation?
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));
String data;
while (true) {
data = reader.readLine();
if (data.equals("exit")) {
break;
}
try {
if (data.contains(".")) {
Double data1 = Double.valueOf(data);
print(data1);
} else if (Short.valueOf(data) > 0 && Short.valueOf(data) < 128) {
short data2 = Short.valueOf(data);
print(data2);
} else if (Integer.parseInt(data) <= 0 || Integer.parseInt(data) >= 128) {
print(Integer.parseInt(data));
}
} catch (Exception e) {
print(data);
}
}
}
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);
}
}