The system cannot find the file specified in java
The system cannot find the file specified in java
Try to list all files names in the directory by calling:
File file = new File(.);
for(String fileNames : file.list()) System.out.println(fileNames);
and see if you will find your files in the list.
I have copied your code and it runs fine.
I suspect you are simply having some problem in the actual file name of hello.txt, or you are running in a wrong directory. Consider verifying by the method suggested by @Eng.Fouad
The system cannot find the file specified in java
You need to give the absolute pathname to where the file exists.
File file = new File(C:\Users\User\Documents\Workspace\FileRead\hello.txt);