PrepZone Logo
PrepZone
Back to Java

Java · Easy

What is var (local variable type inference, Java 10)? What are its rules and limitations?

JavaJava 17+

Answer preview

var (Java 10) enables local variable type inference — the compiler infers the type from the initializer. It is not dynamic typing.…