Programming Tutorials

Comment on Tutorial - for loop in java By Abinaya



Comment Added by : Aruna

Comment Added at : 2011-10-24 14:58:42

Comment on Tutorial : for loop in java By Abinaya
// Using the comma.
class Comma {
public static void main(String args[]) {
int a, b;
for(a=1, b=4; a<b; a++, b—) {
System.out.println("a = " + a);
System.out.println("b = " + b);
}
}
}


Since there is a problem with the decrement operator in the given example you would get such kind of error. If you correct it, u will get the expected result.


View Tutorial