java 中是否有类似于 swift 的 dynamicType 的关键字
is there a keyword in java that's similar to swift's dynamicType
我知道在swift中有一个关键字叫variableName.dynamicType,用来标识变量所属的类型。我只是想知道 java 中是否有类似的关键字?
有Object#getClass
(给你一个java.lang.Class
):
Object x = new BigInteger(123);
System.out.println(x.getClass().getSimpleName());
我知道在swift中有一个关键字叫variableName.dynamicType,用来标识变量所属的类型。我只是想知道 java 中是否有类似的关键字?
有Object#getClass
(给你一个java.lang.Class
):
Object x = new BigInteger(123);
System.out.println(x.getClass().getSimpleName());