









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










122
123
public interface Node { } public class Number extends Node { public int n; } public class Plus extends Node{ public Node left; public Node right; }
126
public interface Node { public int sum(); } public class Number extends Node { public int n; public int sum() { return n; } } public class Plus { public Node left; public Node right; public int sum() { return left.sum() + right.sum(); } } 127
One method for each analysis
134
138
146
150
151
158
159
162
165
170
171
174
public interface Comparable { // Returns negative integer, zero, or a positive integer if this object is less than, equal to, or greater than o. public int compareTo(Object o); }
public interface Comparator { int compare(Object o1, Object o2); }