Reputation: 51
I am trying to define a nested class using Eclipse....
public class Xxx {
private boolean[][] grid;
private boolean OPEN = true;
private Site[][] s;
class Site() {
private int val;
Site() { // empty constructor
}
}
public Xxx(int N) {
........
}
.......
}
On the line defining the inner class, Site, I get an error...
Multiple markers at this line - Syntax error on token "class", @ expected - Syntax error, insert "}" to complete Block
Is my syntax wrong? I don't understand the message.
Upvotes: 5
Views: 3920
Reputation: 6675
Your class Site()
is not a method,its a class.Methods are followed by ()
,classes are simply followed by {}
public class Xxx {
private boolean[][] grid;
private boolean OPEN = true;
private Site[][] s;
class Site {
private int val;
Site() { // empty constructor
}
}
public Xxx(int N) {
........
}
.......
}
Upvotes: 0