首页 > 其他 > 详细

Groovy 数字(主要是介绍下包装类的使用)

时间:2020-07-30 19:26:23      阅读:91      评论:0      收藏:0      [点我收藏+]

1.number的包装类(java差不多)

  Byte,Float,Double,Short,Integer,Long

 

 

2.Groovy中的Numbers表示为类的方法介绍(可以参考java)

      xxxValue()方法,返回值是根据调用的值函数返回的原始类型

      Integer x = 5;

      // Converting the number to double primitive type
      println(x.doubleValue());

      // Converting the number to byte primitive type
      println(x.byteValue());

      // Converting the number to float primitive type
      println(x.floatValue());

      // Converting the number to long primitive type
      println(x.longValue());

      // Converting the number to short primitive type
      println(x.shortValue());

      // Converting the number to int primitive type
      println(x.intValue()); 

     

     

     

Groovy 数字(主要是介绍下包装类的使用)

原文:https://www.cnblogs.com/HuiShouGuoQu/p/13404920.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!