3

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!

sedflix
  • 226
  • 4
  • 13

1 Answers1

3

'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

sedflix
  • 226
  • 4
  • 13