Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

problem in writing object  RSS feed

 
rishman toor
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Report post to moderator
class Car implements Serializable{
..........
}

import java.io.*;
class Carwrite{
public static void main(String[]){
Car c1=new Car(--);
Car c2=new Car(--);
Car c3=new Car(--);
FileOutputStream fo=new FileOutputStream();
ObjectOutputStream oo=new ObjectOutputStream(fo);
oo.writeObject(c1);
oo.writeObject(c2);
oo.writeObject(c3);
oo.flush();
fo.close();
}
}
When i write this code for writing the objects of a class Car i just read only last object.Will u tell me how can i read all written objects of class Car.
Thankzzzzzzzz.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Report post to moderator
Sounds like the trouble is in the reading code. Can you post that, too?
 
Joe Ess
Bartender
Posts: 9428
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Discussion continued here
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!