Here's part of my code
try{
BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
while ((line= in.readLine())!="exit"){
System.out.println("Enter command");
line=in.readLine();
Command currentCommand=new Command(line);
File currentFile= new File(currentCommand.getLsPath());
The method currentCommand.getLsPath()
returns a string, which is mendatory for the File Constracture, and still I get this error: File cannot be resolved to a type
What is the problem?
Chances are you've just missed:
import java.io.File;
from the top of your source file.
You could use
import java.io.*;
I typically use single-type imports.
You need to include either
import java.io.File;
or
import java.io.*;
at the top of your source file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With