Program to print non English characters in Java

You might wonder, how to print Non English characters using Java.

Below is program, which initializes a String literal, using Hexa decimal notation, which has non english characters.

public class multiplyu {
public static void main(String[]args){
	String str = "u0905u0906u0907u0908u0909u0910u0911";
	System.out.println("Non-English Characters:"+str);
}
}

In above program, 0905, 0906, 0907, 0908, 0909, 0910 and 0911 are Hexadecimal representation of Hindi characters. Each of these hexa decimal code need to be prefixed with u to indicate that these are hex literals.

Similarly any Unicode characters can be initialized to String object, and can be printed.

Below is output screen shot:

Print non English characters in Java
Print non English characters in Java

In Eclipse, by default Work space Encoding is Cp1252, which can print only English characters in Console.

Below steps can be used to print non-English characters in Eclipse console.
1.Select Window
2.Select Preferences
3.then Select, WorkSpace
4.On right section, select ‘Text File Encoding’ as UTF-8

Print Non Ascii characters  using Java
Print Non Ascii characters using Java