examples of java programs that read files and put them into arrays
Example 1: java text file to arraylist
Scanner s = new Scanner(new File("filepath"));
ArrayList<String> list = new ArrayList<String>();
while (s.hasNext()){
list.add(s.next());
}
s.close();
Example 2: examples of java programs that read files and put them into arrays
Scanner scanner = new Scanner(new File("input.txt"));
int [] tall = new int [100];
int i = 0;
while(scanner.hasNextInt())
{
tall[i++] = scanner.nextInt();
}