/* File continued write */import Java. io. *; // import the IO package class filewriterdemo3 {public static void main (string [] ARGs) {filewriter fw = NULL; // In tryCodeDefine FW before the block to ensure that fwtry {fw = new filewriter ("demo.txt", true) can be identified in the subsequent try code block; // pass a true parameter, indicating that the existing file is not overwritten. Data is written to the end of an existing file. write ("\ r \ n "); // notepad does not recognize the "\ n" Statement, and uses "\ r \ n"} catch (ioexception E) for line feed) // throw the Exception Handling Mechanism for writing files {system. out. println ("catch:" + E. tostring ();} finally {try {If (FW! = NULL) FW. close (); // refresh and close the file} catch (ioexception e) // throw an exception that closes the file {system. out. println ("catch:" + E. tostring ());}}}}