To declare more than one variable of the same type, you can use a comma-separated list:ExampleGet your own Java Server Instead of writing: int x = 5; int y = 6; int z = 50; System.out.println(x + y + z); You can simply write: int x = 5, y = 6, z = 50; System....
Declare Many Variables To declare more than one variable of thesame type, use a comma-separated list: Example intx =5, y =6, z =50; cout <<x + y + z; Try it Yourself » You can also assign thesame valueto multiple variables in one line: ...