+ 1
Guys why do i get an error when i type this code, that i x is not declared, and its declared in the for loop, help me pls am new
public class Program { public static void main(String[] args) { for(int x = 1; x <=5; x++) { System.out.println(x); } } }
3 Answers
+ 6
This program is running just fine for me. What are you using to run it?
+ 2
Thanks Cruz and Eduardo, i was putting a semicolon after the For loop, thats why i was getting the error. but now it works perfectly.
+ 1
It worked for me.