So here is my code
public static void main(String[] args)
{
ArrayList<Event> pairs = new ArrayList<Event>();
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++)
{
int x = sc.nextInt();
int y = sc.nextInt();
pairs.add(new Event(x, y));
}
Collections.sort(pairs);
for(int i = 0; i < pairs.size(); i++)
{
System.out.println(pairs.get(i));
}
}
I wanted to see that the .in file I gave it with this info
4
5 7
7 8
8 4
4 5
would be sorted correctly, but I wanted to print it out. When I went to try and print it though I got these values in return.
C:\Users\Kneer\Documents\CS2\SCroll>java Main < test.in
Main$Event@5a01ccaa
Main$Event@71c7db30
Main$Event@19bb089b
Main$Event@4563e9ab
am I traversing the Arraylist info incorrectly?