class Student implements Comparable<Student> { // 指定类型为Student private String name ; private int age ; private float score ; public Student(String name,int age,float score){ this.name = name ; this.age = age ; this.score = score ; } public String to…
import java.util.List ; import java.util.ArrayList ; public class Course{ private String name ; private int credit ; private List<Student> allStudents ; public Course(){ this.allStudents = new ArrayList<Student>() ; } public Course(String name…
import java.util.Properties; public class PropertiesDemo01{ public static void main(String args[]){ Properties pro = new Properties() ; // 创建Properties对象 pro.setProperty("BJ","BeiJing") ; // 设置属性 pro.setProperty("TJ","Ti…
import java.util.Vector; import java.util.Enumeration; public class EnumerationDemo01{ public static void main(String args[]){ Vector<String> all = new Vector<String>() ; all.add("hello") ; all.add("_") ; all.add("worl…
import java.util.Set ; import java.util.HashSet ; class Person{ private String name ; private int age ; public Person(String name,int age){ this.name = name ; this.age = age ; } public String toString(){ return "姓名:" + this.name + ":年龄:&quo…
class Person implements Cloneable{ // 实现Cloneable接口表示可以被克隆 private String name ; public Person(String name){ this.name = name ; } public void setName(String name){ this.name = name ; } public String getName(){ return this.name ; } public String toStr…