The Geekiest Hello World

Folks, I think that I have found (one of) the geekiest hello world out there. Implemented in Groovy using the dynamic interception of method calls. Here it goes:

class Hello {
  Object invokeMethod(String name, Object arguments) {
    System.out.println "hello $name!"

def hello = new Hello()

Which produce the following output:

hello john!
hello you!

I suppose the same mechanism can be used with Ruby (and some other dynamic languages).

3 thoughts on “The Geekiest Hello World”

  1. Ha cool, my turn…

    class Hello:
    def __getattr__(self,name):
    print(\Hello \ + name + \!\)

    h = Hello()

    >> prints \Hello pat!\

Comments are closed.