I have to read a text file into an integer array then take an array that already exist and populate it using the newly created array.
Now I have read the text file into an Integer array but can't figure out how to change an existing array so that it is identical to the newly created array.
Below is my code:
public static void loadGrades(int list[]) {
File f = null;
Scanner scan = null;
try{
f = new File("Proj5Data.txt");
scan = new Scanner(f);
}
catch(Exception e){
System.exit(0);
}
ArrayList<Integer> grades = new ArrayList<Integer>();
//Assuming you know all your data on the file are ints
while(scan.hasNext())
grades.add(scan.nextInt());
System.out.println(grades);
for (int i = 0; i < list.length; i++)
list[i] = 1;
}