import java.util.*;
import java.io.*;
public class comparing{
static ArrayList <compare> events = new ArrayList<compare>();
public static void main(String[]args){
  try{
     Scanner in = new Scanner(new File("events.txt"));
     File output = new File("chines.txt");
     Scanner sc = new Scanner(output);
     PrintWriter printer = new PrintWriter(output);
     while(in.hasNext()){
        int temp = in.nextInt();
        String temptwo = in.nextLine();
        //String s = ;
        events.add(new compare(temp,temptwo));
     //System.out.println("Next word is:  " + temp);
        Collections.sort(events);
        for(int i = 0;i<events.size();i++){
           printer.write(events.get(i));
           System.out.println(events.get(i));
        }
     }
  }
  catch(Exception e){
     System.out.println("Invalid file name");
  }
}
My code above reads from a file it sorts the data then prints it out. What I would like to do is write this sorted data to another file but I keep getting the following error:
  comparing.java:27: error: no suitable method found for write(compare)
               printer.write(events.get(i));