首页 > 编程语言 > 详细

java 生成12位随机数,解决The literal 9999999999999 of type int is out of range 问题

时间:2017-11-02 18:46:35      阅读:358      评论:0      收藏:0      [点我收藏+]

原本想这样产生一个随机数,但是你会看到,只要数字超过了9位数,就会出问题,提示“The literal 1000000000000 of type int is out of range”

技术分享

解决方式是把数字转换成long型,在数字后面加上L,代表long型

技术分享

 

java 生成12位随机数,解决The literal 9999999999999 of type int is out of range 问题

原文:http://www.cnblogs.com/chongyou/p/7773606.html

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