What is the mistake in this program.? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the mistake in this program.?

I am writing a program on the series 1 12 Like this It is showing error and asking for identifier. Please help me. the program is given below 👇 public class Program { public static void main(String[] args) { for(int i=1; i<=10; i++) { if (i==2) break; } } System .out.print(i); }

5th Jun 2020, 9:23 AM
Aryan Goel
Aryan Goel - avatar
4 Answers
+ 1
You are trying to print i outside the for loop where variable i is declared.
5th Jun 2020, 9:28 AM
Jay W
0
Ok
5th Jun 2020, 9:29 AM
Aryan Goel
Aryan Goel - avatar
0
No it is solved
5th Jun 2020, 9:35 AM
Aryan Goel
Aryan Goel - avatar
0
But thanks for your helpAMOGHA. A. K.
5th Jun 2020, 9:36 AM
Aryan Goel
Aryan Goel - avatar