+ 1

doubt in chellange question

do{ int y=1; System.out.print(y++ +" "); }while(y<=10) why the answer is code will not compile.

16th Jun 2020, 4:16 PM
Poonam agarwal
Poonam agarwal - avatar
2 Answers
+ 2
Run this. int y=1; do{ System.out.print(y++ +" "); }while(y<=10); 1) int y was declared and initialized inside the do so it is accessible only inside the loop or it is local to the loop. While doesn't know what y is. 2) you are missing a ; at the end of while.
16th Jun 2020, 5:14 PM
Avinesh
Avinesh - avatar
0
Data + string gives string in s.o.p() argument
16th Jun 2020, 4:41 PM
Poonam agarwal
Poonam agarwal - avatar