判断数据类型的方法
1、打开IDEA或其他开发工具

2、编写判断数据类型Demo。代码如下:public class Test { public static void main(String[] args) { int i =1; double d =2d; float f = 1.3f; String s = "str"; Object[] arr =new Object[]{i,d,f,s}; for (int j =0;j<arr.length;j++){ if(arr[j] instanceof Integer){ System.out.println(arr[j]+" is Integer"); } if(arr[j] instanceof Double){ System.out.println(arr[j]+" is Double"); } if(arr[j] instanceof Float){ System.out.println(arr[j]+" is Float"); } if(arr[j] instanceof String){ System.out.println(arr[j]+" is String"); } } }}

3、运行Demo,右击Run xx或者Debug xx .

4、查看运行结果
