+ 1
Please explain
for (int x = 6; x < x * x; - - x) { System.out.print(x); } output: 2 (last num. that will be printed)
3 Answers
+ 4
Output is 65432.
6 < 6*6 is true
5 < 5*5
...
1 < 1*1 is false hence, loop stops.
+ 2
Simba is right. if you want to get it to negative integers use "<=" operator instead of "<" operator. But that way, it will be an infinite loop.
+ 1
thanks!!!