import java.util.*; import java.io.*; public class Test { public static void main(String args[]) throws IOException { ArrayList S = new ArrayList(); // // create an array list of strings // Scanner fin = new Scanner(new File(args[0])); while (fin.hasNext()) S.add(fin.next()); fin.close(); // // take from the command line a file name, open a scanner for that // read the file into the array list // close the file // PrintWriter fout = new PrintWriter(new FileOutputStream(args[0])); for (String s : S) fout.print("not."+ s +" "); fout.close(); // // open an output file, same name as input file // write the array list into that file prepending "not." to each string // close the file // } }