//排序 遍历输出所有 stringList集合 元素
System.out.println("----------排序后------------");
Collections.sort(stringList);
for (String string : stringList) {
System.out.println("元素:"+string);
}
}
System.out.println("----------排序后------------");
Collections.sort(stringList);
for (String string : stringList) {
System.out.println("元素:"+string);
}
}
2015-01-03
/**
* 练习:
* 利用Collections.sort()方法对泛型为String的List进行排序
* 1.创建完List<String> 之后,往其中添加十条随机字符串
* 2.每条字符串的长度为10以内的随机整数
* 3.每条字符串的每个字符为随机生成的字符,字符可以重复
* 4.每条随机字符串不可以重复
* 练习:
* 利用Collections.sort()方法对泛型为String的List进行排序
* 1.创建完List<String> 之后,往其中添加十条随机字符串
* 2.每条字符串的长度为10以内的随机整数
* 3.每条字符串的每个字符为随机生成的字符,字符可以重复
* 4.每条随机字符串不可以重复
2015-01-03
最赞回答 / 伊兮尘昔
courses这个是存放的元素,coursesToSelect调用了removeAll这个方法后可以删除courses中存放并且在coursesToSelect中已有的元素
2015-01-02
String 对象创建后则不能被修改,是不可变的,所谓的修改其实是创建了新的对象,所指向的内存空间不同.
String s1 = "爱慕课";
String s2 = "爱慕课";
这俩Java只创建一个,所以s1 == s2返回true
String s1 = "爱慕课";
String s2 = "爱慕课";
这俩Java只创建一个,所以s1 == s2返回true
2015-01-02
Calendar 类提供了 getTime() 方法,用来获取 Date 对象,完成 Calendar 和 Date 的转换,还可通过 getTimeInMillis() 方法,获取此 Calendar 的时间值,以毫秒为单位.
2014-12-30
1、 调用 SimpleDateFormat 对象的 parse() 方法时可能会出现转换异常,即 ParseException ,因此需要进行异常处理
2、 使用 Date 类时需要导入 java.util 包,使用 SimpleDateFormat 时需要导入 java.text 包
2、 使用 Date 类时需要导入 java.util 包,使用 SimpleDateFormat 时需要导入 java.text 包
2014-12-30