Type Declarations v/s Type Inference

An alternative approach is to do type inference.

<aside> 💡 Derive type information from the context.

</aside>


Type Inference

Typing judgements should ideally be made at compile-time, not run-time → Static Analysis of Code.


Type Inference in Java

Java allows limited Type Inference.

<aside> 💡 Use generic var to declare variables. Must be initialized when declared.

</aside>