0
I'm trying to read file from the console and its not working
import java.io.*; import java.util.*; public class ChangeSystemOut { public static void main(String[] args){ ArrayList<String> list = new ArrayList<String>(); Scanner disk = new Scanner(System.in); String diskreader = disk.nextLine(); Scanner diskScanner = new Scanner(new File(diskReader)); while (diskScanner.hasNext()){ list.add(diskScanner.nextLine()); } list.remove(0); list.add(2,"Favour"); for(String name: list){ System.out.println(name); } diskScanner.close(); } }
3 Answers
+ 1
Spelling not matching in diskReader and diskreader..
Here in SoloLearn, it won't work of external file manipulations.....
0
Jayakrishna thanks bro... I'm so sorry for the mistake
0
No need to say sorry..
You're welcome...