Online Java Compiler By
JavaTpoint.com
import java.util.Scanner; public class JavaCharactergetDirectionalityExample2 { public static void main(String[] args) { // Ask the user for the first input. System.out.print("Enter the first input:"); // Use scanner to get the user input Scanner s1 = new Scanner(System.in); // Gets the first user input char[] value1 = s1.nextLine().toCharArray(); // The Unicode directionality property for the given character for (char ch1 : value1) { byte result1 = Character.getDirectionality(ch1); System.out.println("The Unicode directionality property for the character " + ch1+ " is " + result1); } // Ask the user for the sercond input. System.out.print("Enter the second input:"); // use scanner to get the user input Scanner s2 = new Scanner(System.in); // gets the user input char[] value2 = s2.nextLine().toCharArray(); // The Unicode directionality property for the given character for (char ch2 : value2) { byte result2 = Character.getDirectionality(ch2); System.out.println("The Unicode directionality property for the character " + ch2+ " is " + result2); } } }
Output