You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
809 B

11 months ago
// Two problems with information hiding in this example program.
public class CS495 {
public static int nextStudentID = 1;
public static void main(String[] args) {
Student[] students = new Student[12];
students[0] = new Student("Clark Kent");
students[1] = new Student("Bruce Wayne");
students[2] = new Student("Hal Jordan");
students[3] = new Student("Oliver Queen");
students[4] = new Student("Steve Rogers");
students[5] = new Student("Barry Allen");
students[6] = new Student("Barbara Gordon");
students[7] = new Student("Tony Stark");
students[8] = new Student("Peter Parker");
students[9] = new Student("Billy Batson");
students[10] = new Student("Bruce Banner");
students[11] = new Student("Diana Prince");
for(Student s : students) {
System.out.println(s);
}
}
}