import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;
public class question2_Arrays {
public static void main(String[] args) throws FileNotFoundException{
double[]loanbalanceArray = new double[500];
int index = 0;
File file = new File("loanbalance.txt");
Scanner inputFile = new Scanner(file);
while(inputFile.hasNext()&& index<loanbalanceArray.length){
loanbalanceArray[index] = inputFile.nextInt();
index ++;
}
inputFile.close();
I am trying to read the contents of the text file loanbalance into an array sized 500 this is what i have so far but when i execute the program it gives me this error "Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source)"
any suggestions where i could be going wrong?