Variables

The same syntax is used to declare class variables (aka fields or properties), local variables in methods, and method arguments. In the last case, you can't specify an initial value.

// <type-name> <variable-name> [= <value>];
int a = 34;
Integer b = 2+2;

The var keword was introduced in Java 10. It allows you to get the type of a local variable from the type of the initializing value. You can't declare a class field with var.

var c = false; // same as boolean c = false;
var i; // invalid, variable without initial value