java - can i make if's shorter? -
is possible make if statements shorter? example:
if (intno == 0 || intno == 4 || intno == 7)
could like:
if (intno == 0 || 4 || 7)
that'll bring error, there that?
for integer types , enums, use switch statement instead:
switch(intno) { case 0: case 4: case 7: //code here break; }
this works strings in java 7+
Comments
Post a Comment