x, y, z = 4, 64, 4
[Java] Multiple vars in one line
Started by svdragster, Jul 09 2013 02:56 PM
10 replies to this topic
#1
Posted 09 July 2013 - 02:56 PM
Hey, does anyone know if something like this is possible in Java, too?
#2
Posted 09 July 2013 - 03:01 PM
why not assign them like this?
int x = 4,y = 64, z = 4;
#3
Posted 09 July 2013 - 03:01 PM
You can if they're all the same type, the syntax is...
int x=4, y=64, z=4;
#4
Posted 10 July 2013 - 02:43 AM
Provided they're all the same value and type, you can also do shit like
int x = y = z = 4;
#6
Posted 10 July 2013 - 03:52 AM
Wasn't it introduced in 1.7?
#7
Posted 10 July 2013 - 03:57 AM
I always have the latest version of Java and my Eclipse errors:
Multiple markers at this line - z cannot be resolved to a variable - y cannot be resolved to a variable
#9
Posted 10 July 2013 - 09:58 AM
I thought it was
int x, y, z = 2;
#11
Posted 11 July 2013 - 05:15 AM
3 user(s) are reading this topic
0 members, 3 guests, 0 anonymous users














