import java.io.*;
import java.util.*;
class List{
Scanner s = new Scanner("A.txt");
ArrayList<String> list = new ArrayList<String>();
while (s.hasNext()){
list.add(s.next());
}
s.close();
}
}
In my current working directory I have a file A.txt which contains some data, but I am unable to read and print it in the array list.
It also throws some exception while compiling this code.