• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Write and Read Records

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You guys...I need some help...
I need to use this file to write a program that will allow me to write or read records of type PetRecord to a file. I need to ask the user if he wants to write or read to a file, and I have to ask for the file name.
And I need to redefine the class PetRecord so that is is serializable.
Im lost....could any of you give me some 'simple' instructions...I'd surely apreciate it.

Thanks a million.
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the information you need is covered here. Read the tutorial, try do something towards your project and then get back to us when your really stuck.
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rose,

In addition to Nigel's advice, I'd also look at tidying up your PetRecord class. In particular, you seem to be following the javabean methodology of getters and setters - as far as your setters are concerned, you should change your the name of your set methods to setXxxxx, where Xxxxx is the name of your class attribute (name, age , weight ). You appear to have quite a bit of repeated code within your class as well. Also, try to keep your constructors together within your class rather than mixing them up with the other methods - it just makes things easier to read.

Regards,
JD
 
Rose Evans
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks you guys...I'll see what I can do.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic