public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
String[] label = new String[n];
int[] data = new int[n];
int x = 0;
for(x = 0; x < n*2; x++)
{
if (x<n)
{
label[x] = scan.nextLine();
}
if (x >= n)
{
data[x-n] = scan.nextInt();
}
}
System.out.print(data[0]);
}
When I try to input this, for example:
4
one
two
three
four
I get an error at "four." Shouldn't it be putting these string values into the array?