My code is as follows
import java.util.*;
import java.io.*;
class Main {
public static int MAXROUTINE = 10; //max number of routines
public static int MAXDANCERS = 26; //and dancers for test case
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int r = scnr.nextInt(); //num routines, R
//get routine info
int recital[][] = new int[MAXROUTINE][MAXDANCERS]; //initialize default array
for(int i=0; i<r; i++){
String routine = scnr.nextLine(); //get the routine
for(int j=0; j<routine.length(); j++){ //split routine
recital[i][j] = routine.charAt(j); //by dancer
System.out.println(i + ", " + j);
}
}
scnr.close();
}//end of main
}
However, it appears that the first instance of the nested loop has i=1. When given input
5
ABC
ABEF
DEF
ABCDE
FGH
The code outputs
1, 0
1, 1
1, 2
.
.
.
Because of this recital[0][] is not being altered. Why is i being incremented, and how do I make it not increment on that initial loop?