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)

