What am i doing wrong? "For loop"

this happens way too many times to me. i swear i write the correct codes but it wont accept it until i tell it to give me the code. even with the parts where they tell you what code to write, it doesnt work sometimes.

this is what im dealing with now:
this is the code i write: for (int waterlevel = 0; waterlevel < 7; waterlevel++)

and when i tell it to give me the code it writes this:
for (int waterLevel = 0; waterLevel < 7; waterLevel++) {

when i try my code that is supposed to work it gives me these error messages:
For.java:6: error: cannot find symbol
System.out.println(“The pool’s water level is at " + waterLevel + " feet.”);
^
symbol: variable waterLevel
location: class For
1 error

please help as i just started 2 days ago and im really excited and this annoys me alot

There is an error somewhere in your code but it is not shown here.
Also you should probably check the code on the line that is being flagged for errors

the l in level should be capital.

For future exercises you should understand that variable naming is important. waterLevel.

public class For {
	public static void main(String[] args) {

		for (int waterLevel = 0; waterLevel < 7; waterLevel++) {
			
			System.out.println("The pool's water level is at " + waterLevel + " feet.");

		}
		
	}

}

The ‘l’ should be written in capital letters ‘waterLevel’.
Above code should execute without errors.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.