Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class A {
- class Point implements Comparable<Point>{
- int x, y;
- Point(int x, int y){
- this.x = x;
- this.y = y;
- }
- @Override
- public int compareTo(Point o) {
- if(this.x == o.x) return this.y - o.y;
- return this.x - o.y;
- }
- }
- void solve(){
- Point[] a = new Point[2];
- a[0] = new Point(1, 2);
- a[1] = new Point(2, 1);
- }
- public static void main(String[] args)
- {
- new A().solve();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement