I open a file and want to put the contents in a string array. I tried as below.
String[] names;
s = new Scanner(new BufferedReader(new FileReader("outfile.txt")));
while (s.hasNext()) {
String item = s.next();
item.trim();
email = item;
names = email;
}
But I know that this is a wrong way of adding elements into my string array names []. How do I do it? Thanks.