In Java, each number is associated with a character. For example:
int ch = 65;
System.out.print((char)(ch)); // output: A
Similarly,
System.out.print((char)(66)); // output: B
and so on
This is my code:
for (int line = 1; line <= 4; line++) {
for (int ch = 65; ch <= line; ch++) {
System.out.print((char)(ch));
}
System.out.println();
}
I was expecting this output:
A
BC
DEF
GHIJ
Instead, I got:
(yup, nothing!)
What am I doing wrong?