在intellij中找不到符号(路径)

时间:2023-01-25 20:25:50

i tried to use java.nio.file package ,but when i use Path class using intellij,i got this error:

我试图使用java.nio.file包,但是当我使用Intellij的Path类时,我收到了这个错误:

cann't find symbol (path)

code:

import java.nio.file.Files;
import java.nio.file.Paths;


public class IO_METHODS {

    public static void main(String args[]){

    Path target= Paths.get("mytext.txt");
    Path file= Files.createFile(target);



    }

}

why did i get this error ?

为什么我得到这个错误?

1 个解决方案

#1


2  

You didn't import Path . Do

你没有导入Path。做

import java.nio.file.Path
//...rest of imports and code

#1


2  

You didn't import Path . Do

你没有导入Path。做

import java.nio.file.Path
//...rest of imports and code