Correction in the code.
1.) Inside the loop while list[0] = numberArray; will continue to add elements to the same index 0 , so the lat value will be overridden. So something like list[i] = numberArray; will work, and increement i inside while loop . Take care of ArrayIndexOutOfBound Exception here.
public static void main(String[] args) throws Exception { int numberArray = 0; int[] list = new int[16]; File numbers = new File("numbers.txt"); int i =0;
source share