coconutfury
coconutfury

Reputation: 15

Syntax error that makes no sense to me

I was just starting a small program for fun and I got the error Syntax error on token ";", { expected after this token after the static int declaration.

class Counter {
    public static int counter;  

    for(;;) {

    }
}

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

    }
}

Upvotes: 0

Views: 83

Answers (2)

Reimeus
Reimeus

Reputation: 159754

The for statement should be in a code block such as method rather than the class block

Upvotes: 3

Jobs
Jobs

Reputation: 3377

You have to put the for statement and body in a method.

Upvotes: 2

Related Questions