Last active
May 20, 2018 09:27
-
-
Save jwalgemoed/e666eda99299fba5548c430337a5bf3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Can't use the local variable type inference with fields | |
public class SomeClass { | |
// Not allowed, var is only available for local variables | |
var property = ""; | |
} | |
// Can't leave values unitialzed | |
var uninitialized; // No way to infer the type | |
// Can't just assign null to var to reassign later (but workaround available) | |
var nullVariable = null; // No way to infer the type, also not legal | |
var castedNull = (String) null; // This is legal, inferred type will be String |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment