Local-Variable Type Inference (var keyword)
GPTKB entity
Statements (23)
Predicate | Object |
---|---|
gptkbp:instanceOf |
gptkb:programming_language
|
gptkbp:cannotBeArrayInitializer |
true
|
gptkbp:cannotBeNullInitializer |
true
|
gptkbp:category |
type inference
Java syntax |
gptkbp:example |
var list = new ArrayList<String>();
|
gptkbp:hasKeyword |
var
|
https://www.w3.org/2000/01/rdf-schema#label |
Local-Variable Type Inference (var keyword)
|
gptkbp:introducedIn |
gptkb:Java_10
|
gptkbp:notAllowedFor |
fields
method parameters return types |
gptkbp:purpose |
to allow the compiler to infer the type of local variables
|
gptkbp:requiresExplicitInitializer |
true
|
gptkbp:scope |
local variables
|
gptkbp:similarFeatureIn |
gptkb:TypeScript
gptkb:C# gptkb:Kotlin |
gptkbp:staticTyping |
true
|
gptkbp:typeSafety |
preserved
|
gptkbp:usedIn |
gptkb:Java
|
gptkbp:bfsParent |
gptkb:Java_10
|
gptkbp:bfsLayer |
7
|