HOW TO PRINT HINDI CHARACTERS USING JAVA

 

Following is the simple program with which you can print the hindi language characters using JAVA programming language.

package printhindi;public class Hindi {     public static void main(String args[]) {

     char c;

     for (c = 2309; c < 2360; c++

           System.out.print(” ” + c);

}

}

 

 

The simple logic behind is that we are getting these characters with the help of their ASCII values. The ASCII value for first hindi character is 2309 and for the last is 2360.

 

One important thing, first time you run this program, it will show QUESTION MARKS in the console/output. Then you need to do the save the file in UDF-8 or UDF-16 format. You can do this like this.

Right click on the java file. Go to properties. Then in Resource tab, in Text File Encoding, click on the Others and select either UTF-8 or UTF-16 from the drop down list.

 

Following screenshots will help you during the process.

Java Program
java program screenshot
first output
the initial output

 

 

 

java file properties option selected
right click option on Java file
text file encoding options
selecting text file encoding from resource tab
selecting UTF-8 text enco
select utf-8 and click on apply and ok

output

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s