What type is a var?

Main menu:

Topics

Recent Posts

Feeds

RSS Feed RSS - Posts

January 2019
M T W T F S S
« Dec    
 123456
78910111213
14151617181920
21222324252627
28293031  

Past Posts

Java/Java EE

JDBC

Other

Archive for the tag "var"

What type is a var?

December 25th, 2018 by Jeanne Boyarsky

Java 10 introduced “var” where the type of the variable is implied. This leads to some tricky scenarios. We first learn that “var” can replace the type. That means these two code blocks are equivalent. Ok. So far so good. Now we have this code: So we substitute var and the code no longer compiles! […]

[2018 oracle code one] Var with Style

October 23rd, 2018 by Jeanne Boyarsky

Var with Style – Local Variable Type Inference with Java Speaker: Stewart Marks Oracle #VarWithStyle For more blog posts, see The Oracle Code One table of contents Local variable type inference “var” tells compiler to infer the type Still a static type. Should compile same as if typed the class name Type inference is not […]

var in java 10

August 1st, 2018 by Jeanne Boyarsky

In my Java 10/11 talk, I ask the audience if this code compiles: I usually get about a 50/50 response. The answer is that it does compile due to backward compatibility. You could have a local variable named var and it should still work. When I gave the talk at the NY Java Sig tonight, […]