I learned today that var in Java is not actually a language keyword.
It is a reserved type name. You can use it as a variable:
var var = "world";
System.out.println("hello " + var);
Why anyone would do that, apart from alarming the code reviewer, I do not know.
That is almost as interesting as Java's non-denotable types...
Because var infers the anonymous class type rather than Object, the quack() method remains accessible.
var duck = new Object() {
void quack() {
System.out.println("Quack!");
}
};
duck.quack();
// outputs: Quack!
Interesting times in the Java world.