【问题标题】:is there a keyword in java that's similar to swift's dynamicTypejava中是否有类似于swift的dynamicType的关键字
【发布时间】:2016-08-02 13:59:52
【问题描述】:

我知道在swift中,有一个关键字叫variableName.dynamicType,用来标识变量所属的类型。我只是想知道java中是否有类似的关键字?

【问题讨论】:

    标签: java variables types dynamictype


    【解决方案1】:

    Object#getClass(给你一个java.lang.Class):

     Object x = new BigInteger(123);
     System.out.println(x.getClass().getSimpleName());
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-09
      • 1970-01-01
      • 2016-04-03
      • 2010-09-24
      • 2020-04-23
      • 1970-01-01
      相关资源
      最近更新 更多