Discussion :: Flow Control - Finding the output (Q.No.11)
Mohan said: (Jan 9, 2012) | |
Compilation fails on the line 5 - System.out.println(i); as the variable i has only been declared within the for loop. It is not a recognised variable outside the code block of loop. |
Archit Rai Saxena said: (Mar 27, 2014) | |
if i has declared within the loop. then what will be the output. for (int i = 0; i < 4; i += 2) { System.out.print(i + " "); System.out.println(i); } |
Raman said: (Sep 26, 2015) | |
If I has declared within the loop. Then what will be the output. for (int i = 0; i < 4; i += 2) { System.out.print(i + " "); System.out.println(i); } O/p = 0 0. 2 2. |
Rohit Singh Rathour said: (Sep 30, 2021) | |
The answer is D compilation fail because "i" is declared in the for a loop. So, it can't be accessed outside the loop. |
Post your comments here:
Name *:
Email : (optional)
» Your comments will be displayed only after manual approval.