char data type in java, char variables behave like integers.

Java Programming Language / Character Class in java

1639

Program:

 // char variables behave like integers.
class CharDemo2 {

	public static void main(String args[]) {
	char ch1;
	ch1 = 'X';
	System.out.println("ch1 contains " + ch1);
	ch1++; // increment ch1
	System.out.println("ch1 is now " + ch1);

	}
}

Output:

ch1 contains X
ch1 is now Y
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.