String input = "";
try{
Integer.parseInt(input);
System.out.println("整数");
}catch(NumberFormatException nonIntegerExp){
try{
Double.parseDouble(input);
System.out.println("是double类型");
}catch(NumberFormatException nonDoubleExp){
System.out.println("不是int,也不是double");
}
}
用instanceof
如if(Integer instanceof value){
}