Syntax Error: Insert } To Complete Classbody
Solution 1:
You really want to go to the top of your file and do proper and consistent indention all the way to the bottom.
For example...
private void putThreeBeepers()
{
for (int i = 0; i < 2; i++) {
putBeeper();
move();
}
putBeeper();
}
private void backUp()
{
turnAround();
move();
turnAround();
}
Odds are, somewhere along the line, you are missing a }. Your description isn't super clear, but if the code you posted is how you actually have it formatted in your file then odds are you just missed something somewhere... and poor indentation makes it very hard to spot.
The fact that the message is changing is confusing, but it is the sort of thing you see in these cases.
Solution 2:
the error might be misleading. In my case i had incorrect/incomplete comment statements such as below which is broken lead to this error:
/*
// */
*/
Fixing the comments fixed the error. Hope this helps. Thanks.
Solution 3:
I think this can be caused by a number of different problems. :(
In my case it was that I have forgotten to specify the type of two parameters in one of my methods declareations. To fix I had to change this: onUpgrade(SQLiteDatabase pDb, pOldVersion, pNewVersion) {
} to this: onUpgrade(SQLiteDatabase pDb, int pOldVersion, int pNewVersion)
Solution 4:
It might be due to invisible Chars when copying code from PDF ebook. Be careful of the little red dot '.'
Choose 'Select First Character' -> then delete it.
Solution 5:
Also, the same error might occur if you accidentally write an if-statement outside of a method. I kept overlooking it since I was looking at the bracket-matching only.
Post a Comment for "Syntax Error: Insert } To Complete Classbody"