I'm just starting to learn java as part of a class I am required to take as a math major. I am feeling completely lost. I guess we're supposed to learn this as independently as possible. I was watching a video and tried copying the author's code into bluej and it gives me an error.
I apologize in advance if I am not copying it here correctly.
class WhileLoop
{
int counter=0;
while (counter<10)
{
System.out.println (counter);
counter++;
}
}
The error is at the line "while (counter<10) and it is "illegal start of type". I did try putting curly braces before while and at the end of it all but that also got the same error.
I'm still learning and I've tried reading a few posts before posting here. Other posters indicated curly braces were a problem for other problem posts but I don't think I'm missing a complete pair anywhere.
So any advice would be greatly appreciated.
Christina