After reading and talking about Java 10s new reserved type name var
(JEP 286: Local-Variable Type Inference), one question arose in the discussion.
When using it with literals like:
var number = 42;
is number
now an int
or an Integer
? If you just use it with comparison operators or as a parameter it usually doesn't matter thanks to autoboxing and -unboxing.
But due to Integer
s member functions it could matter.
So which type is created by var
, a primitive int
or class Integer
?