"Auto increment" alphabet in Java?

auto-increment, java

Solution

Yes, you can do it like this:

for (char alphabet = 'A'; alphabet <= 'Z'; alphabet++) {
    System.out.println(alphabet);
}

It is also possible with typecasting:

for (int i = 65; i <= 90; i++) {
    System.out.println((char)i);
}

Problem

"Auto increment" alphabet in Java - is this possible? From A to Z without a third-party library?

Original source