Multiple Variables
In short: Declaring several variables of the same type in a single line, instead of writing a separate line for each one.
In more detail: Syntax: int a = 1, b = 2, c = 3; — saves lines, but can worsen readability, especially when the variables aren’t closely related in content. Variables of different types still need separate declarations.
In Depth
int a = 1, b = 2, c = 3; // three separate variables, each with its own value
int x, y, z; // declared, no value yet
x = y = z = 0; // multiple assignment: all three receive the same value
// Caution: the type applies to the WHOLE line
int i = 0, j; // ok
// int i = 0, String s; // ERROR - different types need separate linesGoogle’s Java style guide and many other team conventions explicitly advise against multiple declarations on one line (except for very closely related counter variables, e.g. in the header of a nested for loop: for (int i = 0, j = 10; i < j; i++, j--)), because they make reading, and especially debugging, harder — a breakpoint or an error message usually refers to a single variable, and with combined declaration lines it’s less clear at first glance which of the several variables is meant. x = y = z = 0; works because an assignment in Java is itself an expression that returns the assigned value — evaluation runs right to left.
Where multiple declaration is genuinely common
The practically most common, generally accepted place for multiple declaration is the header of a for loop with several running variables: for (int i = 0, j = arr.length - 1; i < j; i++, j--) — here the variables are closely related in content (both control the same loop flow), which invalidates the usual readability objection. Outside such closely related, functionally connected cases, one variable per line is almost always preferred in practice.
Constants on the same declaration line
The same comma-separated principle also works with final variables (Constants): final int A = 1, B = 2, C = 3; — the same style considerations apply here as for normal variables, with the added advantage that constants are often closely related thematically anyway (e.g. several related configuration values), which makes multiple declaration seem more justified here more often.
See also: Declaring Variables, Identifiers, Constants