Skip to content

Instantly share code, notes, and snippets.

@jmatt
Created June 3, 2011 18:06
Show Gist options
  • Save jmatt/1006820 to your computer and use it in GitHub Desktop.
Save jmatt/1006820 to your computer and use it in GitHub Desktop.
And a $ back at ya.
package $;
public class $
{
boolean hah;
public $()
{
hah = true;
}
}
#### Andy Lenards favorite java one liner in action _$ $ = new $();_
```javac hah.java
java hah
```
import $.$;
public class hah
{
public static void main(String args[])
{
$ $ = new $(); // amen.
System.out.println("hah!");
}
}
@jmatt
Copy link
Author

jmatt commented Jun 3, 2011

Andy Lenards (@lenards) favorite java one liner in action $ $ = new $();

java hah

@jmatt
Copy link
Author

jmatt commented Jun 3, 2011

This has gotta be a fun interview question for all those people who claim to "know java".

Write, compile and run a java program which creates an instance of a $ class in the $ package and then prints "hah!" to standard out.

I imagine it could be worded even better than that though... it's quite snarky because the solution is essentially trivial. It's a "can you follow directions" and "do you know the basics" sort of question. In other words: Do you ONLY know how to use Eclipse + Maven and fix bugs?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment