我知道在swift中,有一个关键字叫做variableName.dynamicType,它标识了变量所属的类型。我只是想知道java中是否有类似的关键字?
最佳答案
有 Object#getClass
(它给你一个 java.lang.Class
):
Object x = new BigInteger(123);
System.out.println(x.getClass().getSimpleName());
关于java - java中有没有类似于swift的dynamicType的关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36565095/