N
NickName
Hi,
I may be jumping guns here. I mean I'm totally new to java and yet, I
feel the need to do something like this for typing much less,
o = System.out.println; // problem, what data type for var of o here?
undefined.
or
alias o = System.out.println; // alias is supposed to be a special
command or the sort?
then, I do something like this
for (int i=0; i < 5; i++) {
switch(i)
case 0:
case 2:
case 4:
o(i + " is an even number"); // instead of System.out.println(i +
" is an even number");
break;
case 1:
case 3:
case 5:
o(i + " is an odd number"); // instead of System.out.println(i + "
is an odd number");
break;
default:
o(i + " is neither an odd nor even number");
// instead of System.out.println(i + " is neither an odd nor even
number");
}
Doable? How? TIA.
I may be jumping guns here. I mean I'm totally new to java and yet, I
feel the need to do something like this for typing much less,
o = System.out.println; // problem, what data type for var of o here?
undefined.
or
alias o = System.out.println; // alias is supposed to be a special
command or the sort?
then, I do something like this
for (int i=0; i < 5; i++) {
switch(i)
case 0:
case 2:
case 4:
o(i + " is an even number"); // instead of System.out.println(i +
" is an even number");
break;
case 1:
case 3:
case 5:
o(i + " is an odd number"); // instead of System.out.println(i + "
is an odd number");
break;
default:
o(i + " is neither an odd nor even number");
// instead of System.out.println(i + " is neither an odd nor even
number");
}
Doable? How? TIA.