Meaningless Drivel is fun!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Random Access File modes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Random Access File modes" Watch "Random Access File modes" New topic

Random Access File modes

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
this compiles. But gives a run time error.
RandomAccessFile raf = new RandomAccessFile(f,"+rw");
where f is a File.
The valid modes as I know them (which may be wrong) are "r" and "rw". please enlighten
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
The valid modes are indeed "r" and "rw". "+rw" is not a valid mode.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: Random Access File modes
It's not a secret anymore!