Use char variable as integer


 

Use char variable as integer

This tutorial demonstrate how to use the char variable as an integer.

This tutorial demonstrate how to use the char variable as an integer.

Description:

Here in this example you will see how a char variable works like a integer. The char variable works with pre and post increment operators.

Code:

public class CharInt {
  public static void main(String args[]) {
    char charVar;
    for (charVar = 'A'; charVar <= 90; charVar++) {
      System.out.print(charVar);
    }
  }
}

Output:

Download this code

Ads