This question is about a syntax error OP's getting. The problem is that they're writing
while (1) {
}
When Java expects a boolean, not an integer, as a condition for a while
loop.
The question has been closed as a duplicate of this other question which will solve a problem the user already has but will notice only after they solve the actual problem they're asking about.
In particular, the linked question is about the fact that the code is outside a method, which causes a different error then the one OP asked about.
OP's code is outside a method, but this is not what they're asking, even if they will encounter that problem as soon as they solve their current one.
Is that a legitimate duplicate?