Home Tutorial Java Corejava Use char variable as integer

 
 

Use char variable as integer
Posted on: June 26, 2010 at 12:00 AM
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

Related Tags for Use char variable as integer:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.