开发者

Can i know how to fix this error? is delete method

开发者 https://www.devze.com 2022-12-29 03:22 出处:网络
import javax.swing.*; import java.io.File; public class Third { public static void main(String[] args)throws Exception {
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());
开发者_如何学Python        JOptionPane.showMessageDialog(null, "File deleted" + humanName);
    }

}


Well this line looks suspicious to start with:

File file = new File(+ humanName".txt");

Did you mean:

File file = new File(humanName + ".txt");

It's hard to say how to fix "this error" when you don't say what the error is, and the "is delete method" of your title doesn't make sense either.

0

精彩评论

暂无评论...
验证码 换一张
取 消