Hello.
I would like to know how to turn the following Java code into a multi-threaded one where a thousand threads are created to each write one integer into the output file:
public void writeIntegersToFile () { File outputFile = new File("FirstThousandIntegers.txt"); try { FileWriter out = new FileWriter(outputFile); PrintWriter writer = new PrintWriter(out); for (int p=0; p<1000; p++) writer.println(p); out.close(); } catch (IOException e) { System.out.println("Couldn't open " + outputFile.getName()); } }