Home Tutorial Java Corejava Use char variable as integer

 
 

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

Advertisement

Related Tags for Use char variable as integer:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 26, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com