Store unicode in a char variable in Java
Description
The following code shows how to store unicode in a char variable.
Example
// w w w .jav a 2 s .co m
public class Main {
public static void main(String[] args) {
int x = 75;
char y = (char) x;
char half = '\u00AB';
System.out.println("y is " + y + " and half is " + half);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »