0
我需要幫助的是檢測文件是否打開。如何檢查文件是否打開
以下是我有:
public static void main(String[] args) {
//Prompt user to input file name
SimpleIO.prompt("Enter File name: ");
String fileName = SimpleIO.readLine();
//Create file object
File file = new File (fileName);
//Check to see if file is opened
if (!file.exists()){
System.out.println("The file you entered either do not exist or the name is spelled wrong.\nProgram is now being terminated.\nGoodbye!");}
}
對於將來的問題:請看看[幫助中心](http://stackoverflow.com/help/how-to-ask)。 –