

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Guidelines for good class design in java, including avoiding public fields, making public interfaces complete, and separating interface from implementation. It also covers canonical forms of classes, such as string representation, no-argument constructors, object equality, cloning, and serialization. Equality, identity versus value, and the contract of equality. It also covers the hashcode method, defining hashcode methods, and combining hash codes. Lastly, it discusses inner classes, including static member classes, member classes, local classes, and anonymous classes.
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


public class StudentBody1 { private ArrayList students; /* … / public void addAll(ArrayList students) { / … / } } public class StudentBody2 { private List students; / … / public void addAll(List students) { / … */ } }
// E.g., what will be printed? List points = new LinkedList(); points.add(new Point(10, 20)); If (points.contains(new Point(10, 20))) { System.out.println(“Found!”); } else { System.out.println(“Not found!”); }
Equality (Cont.)