Java 我能知道如何修复这个错误吗?是删除方法吗
首先,这条线看起来很可疑:Java 我能知道如何修复这个错误吗?是删除方法吗,java,Java,首先,这条线看起来很可疑: import javax.swing.*; import java.io.File; public class Third { public static void main(String[] args) throws Exception { String humanName; humanName = JOptionPane.showInputDialog(null, "Enter the file name");
import javax.swing.*;
import java.io.File;
public class Third {
public static void main(String[] args) throws Exception {
String humanName;
humanName = JOptionPane.showInputDialog(null, "Enter the file name");
File file = new File(+ humanName".txt");
System.out.println(file.delete());
JOptionPane.showMessageDialog(null, "File deleted" + humanName);
}
}
你是说:
File file = new File(+ humanName".txt");
当你不说出错误是什么时,很难说如何修复“这个错误”,而且你的标题的“是删除方法”也没有意义。File File=new File(+humanName.txt”);如果卡在这里,它应该读取我的输入并删除我想要访问的文件
File file = new File(humanName + ".txt");