Sign in
Log inSign up

Why does this code, written backwards, print “Hello World!”

Sandra Rosenchild's photo
Sandra Rosenchild
·May 17, 2017

I found this on the Internet:-

class M{public static void main(String[]a‭){System.out.print(new char[]
{'H','e','l','l','o',' ','W','o','r','l','d','!'});}}

This code prints Hello World! onto the screen. Clearly it can be seen public static void main is written backwards. How does this code work? How does this even compile?

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct