help, random access, being more specific

Ok what i want to do exactly is the following:

1)Create a class called employee

2)Allow the user to enter information about the employees(their name, phone number, address), and thus save it onto the storage device

3)Allow the user to finally read the records

import java.util.*;

import java.io.*;

class Inventory

{

static DataInputStream din =new DataInputStream(System.in);

static StringTokenizer st;

publicstaticvoid main(String args [])throws IOException

{

DataOutputStream dos =new DataOutputStream(new FileOutputStream("inventing.txt"));

//reading

System.out.println("Enter code number");

st =new StringTokenizer(din.readLine());

int code = Integer.parseInt(st.nextToken());

System.out.println("Enter number of items");

st =new StringTokenizer(din.readLine());

int item = Integer.parseInt(st.nextToken());

dos.writeInt(code);

dos.writeInt(item);

dos.close();

DataInputStream dis =new DataInputStream(new FileInputStream("inventing.txt"));

int codeNumber = dis.readInt();

int totalItems = dis.readInt();

dis.close();

System.out.println();

System.out.println("Code Number: "+ codeNumber);

System.out.println("Number of items: "+ totalItems);

}

}

Here is an example where i used item code, and item number.

But once i record them, and run the application again it overwrites the information(i guess cause i'm not moving the pointer or using a seek())

To make things clear,i want to allow the user to enter many records, and then read then later using another class(but this is not my concern now)

[2724 byte] By [Ixnaya] at [2007-11-26 22:50:01]
# 1

> Ok what i want to do exactly is the following:

> 1)Create a class called employee

> 2)Allow the user to enter information about

> the employees(their name, phone number,

> address), and thus save it onto the storage

> device

> 3)Allow the user to finally read the records

>

Christ man, stop posting the same over and over! Although this post is slightly more detailed, you can still get started by reading the answer I provided in one of your many cross posts.

http://forum.java.sun.com/thread.jspa?threadID=5152591

prometheuzza at 2007-7-10 12:10:53 > top of Java-index,Java Essentials,New To Java...