public static void main(String[] args) {
File newTxt = new File("C:/Users/cauan/Desktop/newTxt.txt");
if(newTxt.exists()) System.out.println("The file already exists!");
else {
try{
newTxt.createNewFile();
FileWriter fw=new FileWriter(newTxt);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("This is my Prog");
}
catch(Exception e){e.printStackTrace();}
}
}
This is my code.... But i dunno why am i getting an error :/