why do i still get an error saying cannot convert double to string?
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 br = new BufferedReader(new InputStreamReader(System.in));
while(true){
String inp = br.readLine();
if(inp.equals("exit"))
break;
try{
if(inp.contains("."))
print((Double) inp);
else if(!(inp.contains(".")) && inp > 0 && inp < 128)
print((short) inp);
else if(!(inp.contains(".")) && inp <= 0 && inp >= 128)
print((Integer) inp);
}
catch(NumberFormatException e){
print((String) inp);
}
}
}
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);
}
}