摘要: 0-100的 随机整数的获取办法有多种,下面是参考办法之一: (int) (Math.random() * 100) Math.random() 会得到一个0-1之间的随机浮点数,然后乘以100,并强转为整型即可。 eg: [1,6] (int)(Math.random()*(6-1+1)+1); 阅读全文
posted @ 2019-05-15 20:23 战胜橘子 阅读(10956) 评论(0) 推荐(0) 编辑
摘要: /*** 使用foreach语句对数组成员进行遍历* **/ public class ForeachDemo { public static void main(String[] args) { int[] arrays = {1,2,3,4,5};// 对arrays[]数组进行初始化 Syst 阅读全文
posted @ 2019-05-15 20:14 战胜橘子 阅读(976) 评论(0) 推荐(0) 编辑