-2
讀取Java中的文本文件,我想輸入文件名的文件不是file.txt.How修改此代碼如何通過名稱
public static void main (String[] args) throws FileNotFoundException {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the input file name: ");
String newfile = sc.nextLine();
}
你想讀什麼類型的文件? – Masudul
你真的在問:「如何將.txt擴展名添加到文件名?」...你嘗試了什麼? – hyde