public class Student {
public String id;
public String name;
public Set<Course> courses;就是这里有疑问
public Student(String id, String name) {
this.id = id;
this.name = name;
this.courses = new HashSet<Course>();
}
}
package com.imooc.collection;
/**
- 课程类
-
@author Administrator
*
*/
public class Course {public String id;
public String name;
public Course(String id, String name) {
this.id = id ;this.name = name;
}
public Course() {
}
}
为什么在student类中定义的时候,public Set courses; set中的菱形括号
可以写Course类??菱形括号里面不是只能写类型么?