日常整理

1.if(char <= '9' && char >= '0')

比较字符时注意加 ' '

2.type argument cannot be of primitive type

类型参数不能是基元类型

出处: ArrayList<char> charArr = new ArrayList<char>();

3.字符串集合的遍历

4.java可以使用两种方法直接将字符数组转为字符串
方法1:直接在构造String时转换。
char[] data = {'a', 'b', 'c'};
String str = new String(data);
方法2:调用String类的方法转换。
String.valueOf(char[] ch)

扫描二维码关注公众号,回复: 3140714 查看本文章

5.Random

 nextInt(int n): 0(包括)到 n(不包括)之间随机 int 值

猜你喜欢

转载自www.cnblogs.com/bushishucai/p/9631691.html