I\'m a beginner java programmer following the java tutorials.
I am using a simple Java Program from the Java tutorials\'s Data Streams Page, and at runtime, it keeps
Alternatively, you could write out the number of elements first (as a header) using:
out.writeInt(prices.length);
When you read the file, you first read the header (element count):
int elementCount = in.readInt(); for (int i = 0; i < elementCount; i++) { // read elements }