public static void main(String[] args)
   {
      String filename = null;
      InOut in;
      if (args.length > 0) 
      {
         filename = args[0];
         in = new ConsoleInOut();
      }
      else
      {
         JFileChooser chooser = new JFileChooser();
         if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
            filename = chooser.getSelectedFile().getPath();
         in = new WindowInOut();
      }
      if (filename == null) return;
      AddressBook book = new ArrayListAddressBook();
      book.load(filename);
      processCommands(in, book);
   }