Skip to content

Instantly share code, notes, and snippets.

@jwalgemoed
Last active May 20, 2018 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwalgemoed/e666eda99299fba5548c430337a5bf3b to your computer and use it in GitHub Desktop.
Save jwalgemoed/e666eda99299fba5548c430337a5bf3b to your computer and use it in GitHub Desktop.
// 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