java 中如何查看变量数据类型
可以定义一个getType()方法:
public static String getType(Object o){
return o.getClass().toString(); //使用int类型的getClass()方法
}
然后就Ok了
int a = 0;
System.out.println(getType(a))
可以定义一个getType()方法:
public static String getType(Object o){
return o.getClass().toString(); //使用int类型的getClass()方法
}
然后就Ok了
int a = 0;
System.out.println(getType(a))