Plus one to char variable in Java
Description
The following code shows how to plus one to char variable.
Example
// w w w.ja va 2s . com
public class Main {
public static void main(String[] args) {
char a = 'A';
char b = (char) (a + 1);
System.out.println(a + b);
System.out.println("a + b is " + a + b);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »