If someone could help me out here I would really appreciate it...
I have to get this code running for my programming class and i keep getting same symbol error here is the code:

public class fourseventeen {
  public void main(String[] args) {    
    

    int j = 0;
    int sum = 0;
    
    for (int i = 0; i < 10; i++)
      sum += i;

    if (i < j)
    
      System.out.println(i);
    else
      System.out.println(j);

    while (j < 10)
    {
      j++;
    };

    do {
      j++;
    } while (j < 10);
  }
}

It would help if you declared main correctly, as

public static void

Also, you might want to check that the variable 'i' doesn't go out of scope after the for loop.

Okay, I fixed the main and this is what im at right now:

public class fourseventeen {
  public static void main(String[] args) {    
	
	int j = 0;
	int sum = 0;
	
	
	for (int i = 0; i < 10; i++)
		sum += i;
		
	if (i < j)
		System.out.println(i);
	else
		System.out.println(j);
		
	while (j < 10)
	{
		j++;
	};
	
	do {
		j++;
		
	}	while (j < 10);
  }
 }

Im currently receiving the following errors in my build output:
--------------------Configuration: <Default>--------------------
C:\java\fourseventeen.java:11: cannot find symbol
symbol : variable i
location: class fourseventeen
if (i < j)
^
C:\java\fourseventeen.java:12: cannot find symbol
symbol : variable i
location: class fourseventeen
System.out.println(i);
^
2 errors

your variable i is undefined at those lines the compiler is pointing out. perhaps your "for" loop is supposed to encompass more than 1 statement.

Okay,
I added {} in my for loop and that fixed the problem. Thanks all for the responses much appreciated.

This question has already been answered. Start a new discussion instead.