Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有代码int index, r, g, b;,我想将它们全部设置为某个数字,我不想单独写index = 0; r = 0;......等等。
int index, r, g, b;
index = 0; r = 0;
我如何在java中做到这一点? index,r,g,b = 0;对我不起作用。
index,r,g,b = 0;
使用这行代码一次初始化所有变量
r = g = b = index = 0;
否则在您声明时初始化:
int index=0, r=0, g=0, b=0;
初始化所有值,然后设置值。
int index, r, g, b; index = r = g = b = 0;