i wanna ask u that . i have work on it .. let assum that i have make a file ObjectOutoutStream oos = new ObjectOutoutStream(new FileOutoutStream(file.tes)); that file.tes save an one object like that String str = {"Mohummad","Ali","Rafiq",...}; now do we save in that file more than two object???
if u learn to break the rock .. next day u will be looking to Mountain.
John Lee
Ranch Hand
Joined: Aug 05, 2001
Posts: 2545
posted
0
Yes, you can. It is just a 'write' process. You can write as much as you can.
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18652
posted
0
I'm not sure what was being asked: "Can we save more than one object using ObjectOutputStream?" Yes, as Don said - you can keep calling writeObject()as many times as you want, for as many different files as you want, as long as you don't run out of memory or file space. "Can multiple objects be stored as the result of a single writeObject() call?" Yes. In this example
the single writeObject() invocation actually stores one String[] array and three String objects. A later a single readObject() will read all four into JVM memory. [ February 09, 2003: Message edited by: Jim Yingst ]