Reputation: 226
When we write RandomAccessFile r =new RandomAccessFile("file.txt","rw");
how can I create this file in a folder named home on the desktop.. Again it should be a single statement!
Upvotes: 3
Views: 3239
Reputation: 226
'RandomAccessFile r =new RandomAccessFile("C:/Users/Siddharth Yadav/Documents/file.txt","rw");'
RandomAccessFile r =new RandomAccessFile(path_of_file,"rw");
If file already exists then it is opened else the file is created and then opened
Upvotes: 3