I am creating a file called jfv.properties and I want to write a simple string into the file. In this the file is getting created the string is not getting printed. Is there problem in the below code ? I have run in the debug mode, there are no exceptions thrown.
File file = new File(filePath,"jfv.properties");
FileOutputStream fo = null;
try {
fo = new FileOutputStream(file);
PrintWriter p = new PrintWriter(fo);
p.println("some string");
} catch (FileNotFoundException e) {
e.printStackTrace();
}catch (SecurityException s){
s.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(fo != null ){
try {
fo.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}