--------------------------------------------------------------------------------
constructing like
RandomaccessFile raf=new RandomAccessFile("xxx","rw");
what will happen if the file xxx is read-only and we try to write.
if the file xxx exist it is opened in append mode true or false
Also if we wrap a string fxx
as
File f=new File("fxx");
it will compile but when run it will throw exception if fxx
doesnot exist true or false
if true where the file fxx is looked for in current directory or
else
pls clarify my confusion.or i am missing something.
-----------------------------------------------------------------------
Ans. File f=new File("fxx");
Yeah if there is n't any such file exists then at run time iit will throw an IOException.
ya amrit ofcourse fxx file is looked in current directory by default.
if u wanna this it to look in some particular directory.then u have to use a different
constructor of File-----
File f=new File(String path,String filename)
or
File f=new File(File dir , String filename)
here plz note that File object can be a directory or file.ucan check it by
calling boolean method of File class
boolean isFile() or isDirectory().
i hope it will serve the purpose.
------
Munish Dabra
------