字符串连接误用 错误的写法: String s = ""; for (Person p : persons) { s += ", " + p.getName(); } s = s.substring(2); //remove first comma 正确的写法: StringBuilder sb = new StringBuilder(persons.size() * 16); // well estimated buffer for (Person p : pe
用法:可以用法获取当前时间的毫秒数,可以通过毫秒数进行时间比较,时间转化以及时间格式化等.public class SystemTime {public static void main(String[] args) {//定义当时运行的时间变量Long time = System.currentTimeMillis();//打印开始时间的毫秒数System.out.println(time);for(int i =0;i<10000;i++){//什么都不用做}System.out.print