var var

I just learnt today that var in Java is not actually a language keyword. It is actually a reserved magic type name. You can use it as a variable:

var var = "world";
out.println("hello " + var);

Why anyone would ever do that, apart from freaking out the code reviewer, I don’t know 🙂

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s