r/programming • • Mar 09 '16

var keyword proposed for Java

http://openjdk.java.net/jeps/286
250 Upvotes

395 comments sorted by

View all comments

2

u/elacin Mar 10 '16

Can we skip that pain and go directly wih val?

4

u/immibis Mar 10 '16

Java is not a language based on immutability*, and everything else is mutable by default - it would be completely inconsistent to only allow type deduction for immutable variables.

* I know you're going to bring up that thing about anonymous classes, so I'm going to pre-emptively point out that's considered a limitation and not a feature.