package project1;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Project1 {
public static void main(String[] args) throws FileNotFoundException{
//Declaring arrays
String [] teams = new String [50];
int [] runs = new int [50];
//calling class lastvalue where -1 is stored
lastValue value = new lastValue();
int count = value.value;
//instantiating input file
Scanner input = new Scanner(new File("C:\\Users\\andy_\\Documents\\NetBeansProjects\\project1\\baseballteams.txt"));
//while loop
while (input.hasNext()) {
count++;
find next line
teams[count] = input.nextLine();
runs[count] = input.nextInt();
}
//print all teams
for(int i=0; i<=teams.length; i++){
value.value ++;
System.out.println("The teams are:" + teams[count] + "The Runs" + runs[count]);
}
}
}
I want to store the name of teams into the string array and the runs into the int array. However when I run the program it says throws mismatch error in console. I also want to displays the teams name