Please open the menu to show more

Wednesday, August 9, 2017

Feel the power of Unicode in Java Programming language

This awesome code is implemented and provided by Mayank Banga (WW), from GBU, Greater Noida


Some facts: 

1. A Java program can be implemented in Unicode notation. The compiler of Java can read the Java code even if it is written in Unicode notation.
2. Unicode is a unique numeric representation of natural languages (like English, Hindi, Urdu) characters. So by using Unicode we can denote the characters in programming languages. Unicode can supports many natural languages. Up to 65536 characters can be supported.
In Java programming language a Unicode can be specified using \u0000 to \uffff representation.

For example =>

System.out.println("\u0041"); will display A, since Unicode value of A is 65
System.out.println("\u0061"); will display a, since Unicode value of A is 97
System.out.println("\u0040"); will display @, since Unicode value of A is 64


NOTE: Create a Java project in Eclipse IDE, then create a class inside this Java project. The class name must be Unicode.java

\u0070\u0075\u0062\u006C\u0069\u0063\u0020\u0063\u006C\u0061\u0073\u0073\u0020\u0055\u006E\u0069\u0063\u006F\u0064\u0065\u0020\u007B

\u0070\u0075\u0062\u006C\u0069\u0063\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0076\u006F\u0069\u0064\u0020\u006D\u0061\u0069\u006E\u0028\u0053\u0074\u0072\u0069\u006E\u0067\u005B\u005D\u0020\u0061\u0072\u0067\u0073\u0029\u0020\u007B

\u0053\u0079\u0073\u0074\u0065\u006D\u002E\u006F\u0075\u0074\u002E\u0070\u0072\u0069\u006E\u0074\u006C\u006E\u0028\u0022\u0068\u0065\u006C\u006C\u006F\u002C\u0020\u0074\u0068\u0069\u0073\u0020\u0069\u0073\u0020\u0063\u0068\u0061\u0072\u0061\u0063\u0074\u0065\u0072\u0020\u0072\u0065\u0070\u0072\u0065\u0073\u0065\u006E\u0074\u0061\u0074\u0069\u006F\u006E\u0020\u0069\u006E\u0020U\u006E\u0069\u0063\u006F\u0064\u0065\u0022\u0029;

\u007D

\u007D


output of this code is  => hello, this is character representation in Unicode



4 comments:

  1. Brilliant explanation...

    ReplyDelete
  2. "I very much enjoyed this article.Nice article thanks for given this information. i hope it useful to many pepole.php jobs in hyderabad.
    "

    ReplyDelete
  3. It's very interesting and useful for students
    Java Online Training

    ReplyDelete