Online Java Compiler By
JavaTpoint.com
public class JavaCharactergetDirectionalityExample1 { public static void main(String[] args) { // Create two character primitives obj1, obj2 char obj1, obj2; // Assign the values to ch1, ch2 obj1 = 'Q'; obj2 = '1'; // create 2 byte primitives b1, b2 byte b1, b2; // Assign the directionality of obj1 and obj2 to b1 and b2 respectively. b1 = Character.getDirectionality(obj1); b2 = Character.getDirectionality(obj2); System.err.println("The directionality of " + obj1 + " is " + b1); System.err.println("The directionality of " + obj2 + " is " + b2); } }
Output