已采纳回答 / 海哥来了
t1.studentForEach(t1.student);当需要遍历student的Courses(Set集合)的时候,可以直接传入成员变量t1.student否则如果student声明在方法里就是局部变量了。student是作为SetTest类的成员的。console也定义为该类的成员变量,而不是放在用到的方法中声明是因为:console在多个方法中都需要用到,所以作为类成员就只需分配一次堆内存,否则多个方法重新定义Scanner类变量,需要分配多次内存。
2016-08-08
空指针异常解决方法:
createStudentAndSelectCourse方法中创建学生对象,
Student student = new Student(“1”,“小明”);
改为: student = new Student(“1”,“小明”);
createStudentAndSelectCourse方法中创建学生对象,
Student student = new Student(“1”,“小明”);
改为: student = new Student(“1”,“小明”);
2016-08-08
最赞回答 / wusyd1063
下载eclipse的中文语言包,下载地址如下http://www.eclipse.org/babel/downloads.php 汉化教程:http://jingyan.baidu.com/article/bea41d439b4bd5b4c51be6cc.html
2016-08-08