• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on RandomAccessFile

 
Veena Pointi
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In R&H it is given that
"Constructing an instance of RandomAccessFile is like constructing an instance of File :No file is created on the file system."
But the following code creates ab.txt .

How?Is R&H wrong?
Veena
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the API:

So it does look there is some discrepancy here.
Could be that there is no file until the stream get s (maybe) written to, flushed, and closed.
What's R&H?
-Barry
[ August 12, 2002: Message edited by: Barry Gaunt ]
 
Veena Pointi
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
R&H is short name for the book Java2 Certification Study Guide by Simon Roberts & Philip Heller
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry don't have it.
 
zarina mohammad
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In R&H it is given that
"Constructing an instance of RandomAccessFile is like constructing an instance of File :No file is created on the file system."

veena,
another point to note in R&H is that RandomAccessFile creates a file if does not exist only if the instance is created in the "rw" mode. if you run the same code in "r", it throws a FileNotFound exception

-zarina
 
biju joseph
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there IO for certification exam 1.4?
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the 1.4 exam does not include AWT or IO.
 
Barkat Mardhani
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In R&H it is given that
"Constructing an instance of RandomAccessFile is like constructing an instance of File :No file is created on the file system."

Hi Veena, Zarina:
Is it possible that R&H is making the point that
no phyiscal file will be created on file system
immediately after the instance of RandomAccessfile
is created. But as soon as you start writing to
this file, the file will appear at file system level...
Thanks
Barkat
[ August 12, 2002: Message edited by: Barkat Mardhani ]
[ August 12, 2002: Message edited by: Barkat Mardhani ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic