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(); } }

7th Sep 2020, 9:04 AM
Osazuwa Lawson
Osazuwa Lawson - avatar
3 Answers
+ 1
Spelling not matching in diskReader and diskreader.. Here in SoloLearn, it won't work of external file manipulations.....
7th Sep 2020, 9:43 AM
Jayakrishna 🇼🇳
0
Jayakrishna thanks bro... I'm so sorry for the mistake
7th Sep 2020, 10:08 AM
Osazuwa Lawson
Osazuwa Lawson - avatar
0
No need to say sorry.. You're welcome...
7th Sep 2020, 8:58 PM
Jayakrishna 🇼🇳