Hello World in Unicode - java
\u0070\u0075\u0062\u006C\u0069\u0063\u0020\u0063\u006C\u0061\u0073\u0073\u0020\u0055\u006E\u0069\u0057\u0072\u006C\u0064\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\u0029\u007B\u0053\u0079\u0073\u0074\u0065\u006d\u002E\u006F\u0075\u0074\u002E\u0070\u0072\u0069\u006E\u0074\u006C\u006E\u0028\u0022\u0048\u0065\u006C\u006C\u006F\u0020\u0077\u006F\u0072\u006C\u0064\u0022\u0029\u003B\u007D\u007D
Save the content in UniWrld.java and execute it. It will print Hello World. According to java language specification java compiler parses the source code in unicode characters. So if we can write the entire program in unicode alone.
See the following code and guess the output.
public class HelloWorld
{
public static void main(String[] args)
{
// \u000d System.out.println("Hello world");
}
}
Instead of printing nothing it will print Hello world because the unicode \u000d corresponds to line return and put the content System.out.println("Hello world"); in a new line. So all your source code are converted into unicode and then converted into byte code.
Regards,
A S Balaji
Comments
Post a Comment