String e:s.split("")//可以将s拆分成String数组,在String数组中遍历
e.equals("a")//找到字符串a
也可以运行.
e.equals("a")//找到字符串a
也可以运行.
2018-03-22
https://www.imooc.com/article/24028
第一次发手记,如果有需要的小伙伴可以看一下
第一次发手记,如果有需要的小伙伴可以看一下
2018-03-18
Math.random()生成的随机数为[0, 1),将之乘以十得到随机数范围为[0, 10) ,如果用Math.floor()或者直接强制转换进行截取,则最后生成的随机数是不可能出现10的,因此,若要使用 Math.floor(),则必须将Math.random() 乘以11,即(int)Math.floor(Math.random() * 11);
还有一种方法,将Math.random()乘以10后使用Math.round()方法进行四舍五入,再进行强制类型转换,也是可行的,即 (int)Math.round(Math.random() * 10)
还有一种方法,将Math.random()乘以10后使用Math.round()方法进行四舍五入,再进行强制类型转换,也是可行的,即 (int)Math.round(Math.random() * 10)
2018-03-18