数据类型
来源:互联网 发布:js array删除方法 编辑:程序博客网 时间:2024/06/05 09:24
八种原始数据类型
1.整数型3种:int long byte short
2.浮点型:double float
3.字符型:char
4.逻辑型:boolean
数据取整:
向上取整:Math.ceil() //只要有小数都+1
向下取整:Math.floor() //不取小数
四舍五入:Math.round() //四舍五入
取随机数:Math.random()*99 产生0-99之间的随机数
案例:
// 定义一个整型数组,长度为10int[] nums = new int[10]; //通过循环给数组赋值for (int i = 0; i < nums.length; i++) { // 产生10以内的随机数int x =(int) (Math.random()*10);nums[i] = x;// 为元素赋值System.out.print(nums[i]+" ");}
阅读全文
0 0
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- 数据类型
- pandas入门——创建series
- Spark学习总结一 单词计数
- git 还原到某次commit
- 获取手机联系人信息 很简单的方法
- 求最大子序列和 LeetCode 53 Maximum Subarray
- 数据类型
- git 新建、删除分支
- 如何调用百度编辑器ueditor的上传图片、上传文件等模块
- LeetCode——561. Array Partition I(贪心,C++)
- 熄灯问题(枚举、位运算)
- 自动代理的两种实现
- IDEA包分层显示
- ImageLoader工具类
- 通信测试中的仪表自动化