To declare more than one variable of the same type, you can use a comma-separated list:
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.out.println(x + y + z);
You can also assign the same value to multiple variables in one line:
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!