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

Published by milindjagre

I founded my blog www.milindjagre.co four years ago and am currently working as a Data Scientist Analyst at the Ford Motor Company. I graduated from the University of Connecticut pursuing Master of Science in Business Analytics and Project Management. I am working hard and learning a lot of new things in the field of Data Science. I am a strong believer of constant and directional efforts keeping the teamwork at the highest priority. Please reach out to me at milindjagre@gmail.com for further information. Cheers!

9 thoughts on “HOW TO PRINT HINDI CHARACTERS USING JAVA

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: