新建一个newStudent,是为了演示一下put方法吗
String name=in.next();
Student newStudent=new Student(stuID,name);
students.put(stuID,newStudent);
不然直接直接这样不是更快 还不用新建一个newStudent占空间
students.get(stuID).name=in.next();
String name=in.next();
Student newStudent=new Student(stuID,name);
students.put(stuID,newStudent);
不然直接直接这样不是更快 还不用新建一个newStudent占空间
students.get(stuID).name=in.next();
2015-11-07
addAll(Collection); // 添加集合
addAll(index,Collection)//在指定下标添加集合
addAll(index,Collection)//在指定下标添加集合
2015-11-06
public static void main(String[] args) {
String s1 = "imooc";String s2 = "imooc";String s3 = "I love " + s1;
System.out.println("s1和s2内存地址相同吗?" + (s1 == s2));System.out.println("s1和s3内存地址相同吗?" + (s1== s3));
String s4 = "I love " + s1;System.out.println("s3和s4内存地址相同吗?" + (s4 == s3));}
String s1 = "imooc";String s2 = "imooc";String s3 = "I love " + s1;
System.out.println("s1和s2内存地址相同吗?" + (s1 == s2));System.out.println("s1和s3内存地址相同吗?" + (s1== s3));
String s4 = "I love " + s1;System.out.println("s3和s4内存地址相同吗?" + (s4 == s3));}
2015-11-06