0
Till what number will y decrement and why.? In case of Java it is saying cannot convert from int to boolean.! Why is that.?
Working perfectly in c++ int x=1,y=6; while(y--){ x++; }
6 Antworten
+ 4
Shrijith P.S
try something like this in Java.
int x=1,y=6;
while(y-- > 0){
x++;
}
System.out.println(x);
+ 3
Shrijith P.S Good explanation here...
(the case in C and C++ are the same here)
https://stackoverflow.com/questions/36467523/why-while-loop-differently-work-in-java-and-c
+ 2
You can't have integer as a condition. There should be boolean, like while(y > x).
+ 1
C++ is not java, thats why
0
It works RKK ,but in c++ the code written in description works perfectly