Question: What is the output of the following program.
1 import java.util.*;
2 class Chicken implements Comparable<Chicken> {
3 private int weight;
4 public Chicken(int weight) {this.weight = weight;}
5 public int getWeight() {return weight;}
6 @Override
7 public int compareTo(Chicken c) {
8 return this.weight < c.getWeight() ? 1 : (this.weight == c.getWeight() ? 0: -1);
9 }
10 }
11 public class Birds{
12 public static void main(String args[]) {
13 List<Chicken> list = new ArrayList<>();
14 list.add(new Chicken(13));list.add(new Chicken(9));list.add(new Chicken(12));
15 Collections.sort(list);
16 System.out.println(list);
17 }}
Choice:
A. [13, 9, 12]
B. [9, 12, 13]
C. [13, 12, 9]
D. output is none of the above options
E. compiler error at line 2
F. compiler error at line 7
G. compiler error at line 8
H. compiler error at other lines