Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RandomAccessFile

 
donal horgan
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Het there,

Must I declare
RandomAccessFile raf = new RandomAccessFile("foo.txt", "rw");
within a main method or constructor?
My IDE seems to insist on it.
Can I not just declare it within a class?
 
Lara McCarver
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to put that code almost anywhere.
 
donal horgan
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
I was thinking the same myself -- must be some silly error I have which I can't spot.
 
Christy Keane
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error is your IDE throwing up?
 
Lara McCarver
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you have an import statement for RandomAccessFile, that is just about the only thing I can think of that could cause a problem with this statement. Though people say I don't have a big enough imagination so...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic