• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Data File Question

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
My assignment is URLyBird. I have some questions about the Data class, thank you for your help.
1.In the Data class, I can't decide to choose the constructor's parameter between File and RandomAccessFile.
2.If choose the File, then in the class I must new a RandomAccessFile Object, I define it as a Member Variable? or in every method I define a local Variable?
thanks, My Engligh is poor, I hope you can understand what my mean.
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kevin,

the decision is up to you and your implementation. Both File or RandomAccessFile could be appropriate, providing File would express that you want to hide the implementation detail further within your Data class, though.

The choice whether you reference the file in a member variable or as a method parameter is also up to you, the file or at least its location should be stored somewhere, because you need to write and read to it on subsequent calls.
 
kevin kern
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot.Wei-ju Wu,your name seem to like a Chinese?
 
Wei-ju Wu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kevin,

I was born and raised in Germany, but my parents are chinese immigrants.
 
It's never done THAT before. Explain it to me tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic