简体   繁体   中英

In java what does this mean? int x = y, z;

Seems like a very silly question, but i am unable to find an answer on this online.

basically what i am confused about is what does this code mean:

int x = y , z;

Why x has two values, separated by comma?

It's the same like :

int x = y;
int z;

x没有两个值,它具有y值,并且还有另一个int变量z

Those are two separate statements.The first expression x= y is an assignment operation. It assigns the value y to x. The second statement is initialization of z. For this to work, the value y should have been initialized before.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM