The system cannot find the file specified in java

前端 未结 8 892
轮回少年
轮回少年 2020-11-28 08:52

I am making a program that opens and reads a file. This is my code:

import java.io.*;

public class FileRead{
    public static void main(String[] args){
           


        
8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 09:21

    In your IDE right click on the file you want to read and choose "copy path" then paste it into your code.

    Note that windows hides the file extension so if you create a text file "myfile.txt" it might be actually saved as "myfile.txt.txt"

提交回复
热议问题