TAG · 1 ARTICLE

#var

  1. JAVAJava var explained: local variable type inferencevar lets the compiler work out a local variable's type from the value you assign. It is still strongly typed Java, not JavaScript. Here is how it works, where you can and can't use it, and the traps worth knowing.16 Nov 2026 · 5 min