Mixed Pattern Problem

Code:-
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int i = 1;

	while(i<=n){
	 int val = 1;
	 int j = 1;
	 while(j<=n){
	     if(i%2==0){
	     System.out.print(val);
	     val++;
	     }else{
	         char letter = (char)('A'+j-1);
	         System.out.print(letter);
	         letter++;
	     }
	     j++;
	 }
	 System.out.println();
	 i++;
}
}

}
The O/p i want is
1234
ABCD
2345
BCDE
But it didnt match with my O/p