• 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

java I/O

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys, I encoutered a compiler error for the following class. The compiler error was:
Exception in thread "main" java.io.IOException: Access is denied
at java.io.RandomAccessFile.write(Native Method)
at Test.main(Test.java:9)
=================
import java.io.*;
class Test
{
public static void main(String[] args) throws IOException
{
File file = new File("C:\\Begjava\\Test.java");
RandomAccessFile raf = new RandomAccessFile(file, "r");
raf.write(1000); // line 9
}
}
=================
Any suggestions?
thanks :roll:
 
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Brian:
I am pretty green on the IO stuff yet. But in the
following line:
RandomAccessFile raf = new RandomAccessFile(file, "r");
The "r" should be "rw" as you are trying to write
in the following statement...
Can anyone tell me if this topic (IO) out of the
scope of 1.4 exam?
Thanks
Barkat
 
Brian Dang
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Barkat, thanks alot, you are rite. When I change 'r' to 'rw' then it works. I don't know if 1.4 will include I/O.
thanks,
Brian
 
Barkat Mardhani
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I read somewhere that exam 1.4 will not include
I/O. But I am not sure exactly what is within
the scope of I/O. For example, a question like
is out or in the exam. I do not understand why
I/O was taken out of the exam scope when it is an
essential part of app development.
Barkat
 
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks to me like an exception at runtime, not a "compiler error".
The distinction is important when studying for the certification exam.
[ August 18, 2002: Message edited by: Ron Newman ]
 
Brian Dang
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ron, yes it is...you are rite
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic