i would like to create a New file using filewriter Class and use the Exact path in file class(dont want to copy/paste the manually, any chnages in file writer path , we would like to reflect the instances) to get absolute path of the particular file .Can anyone suggest me how.
First i would to create a filewriter and later want to use File to display its attributes such that any chnages in Fiewriter URL would be displayed.
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class files_read {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
FileWriter FW=new FileWriter("C:/Users/91870/Downloads/Boss.txt");
FW.write("yoyo");
FW.close();
File f=new File(FW);
}
catch(IOException ie)
{
System.out.println("An error occurred.");
ie.printStackTrace();
}
}
}````
question from:
https://stackoverflow.com/questions/65858749/copy-path-in-file-writer-class-into-file-class 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…