I try to write something into the filename "aq.txt". There is no problem with the directory.
FileOutputStream fos= null;
try{
String xyz= "You should stop using xyz";
fos= new FileOutputStream("aq.txt");
Writer wrt= new BufferedWriter(new OutputStreamWriter(fos));
wrt.write(xyz);
}
catch(IOException e){
System.out.println("Couldn't write to the file: "+e.toString());
}
finally{
if(fos!=null){
try{
fos.flush();
fos.close();
}
catch(Exception e1){
e1.printStackTrace();
}
}
}