JAVA中如何获取变量的类型?
package xiya; public class Demo { public static void main(String[] args) { String type = getType("123"); System.out.println(type.substring(type.lastIndexOf('.') + 1, type.length())); } public static String getType(Object o) { return o.getClass().toString(); } }