// An example that shows how to create a file from Java. import java.io.FileOutputStream; import java.io.PrintStream; import java.io.IOException; public class FileExample { // This method creates a file with the specified name // and writes the specified int to that file. // It catches and ignores any IOException. public static void writeFile (String filename, int x) { try { FileOutputStream outfile = new FileOutputStream (filename); PrintStream out = new PrintStream (outfile); out.println (x); out.close(); } catch (IOException e) { } } public static void main (String[] args) { writeFile ("temp17", 17); } }