1
我知道在swift中有一個名爲variableName的關鍵字。 dynamicType確定變量所屬的類型。我只是想知道在Java中是否有類似的關鍵字?在java中是否有類似於swift的dynamicType的關鍵字
我知道在swift中有一個名爲variableName的關鍵字。 dynamicType確定變量所屬的類型。我只是想知道在Java中是否有類似的關鍵字?在java中是否有類似於swift的dynamicType的關鍵字
有Object#getClass
(它給你一個java.lang.Class
):
Object x = new BigInteger(123);
System.out.println(x.getClass().getSimpleName());
非常感謝您! – Thor