Coding John
Coding John

Reputation: 53

What does an unexpected token mean and can I solve it?

Android Studio is telling me that there are some "Unexpected Tokens"..

what are these??

screenshots:

error in code where the error is

error in Messages error:

Upvotes: 2

Views: 16523

Answers (2)

Taras Vovkovych
Taras Vovkovych

Reputation: 4252

private InputStream checkForUtf8BOMAndDiscardIfAny(InputStream inputStream) throws IOException {
 PushbackInputStream pushbackInputStream = new PushbackInputStream(new 
 BufferedInputStream(inputStream), 3);
 byte[] bom = new byte[3];
 if (pushbackInputStream.read(bom) != -1) {
    if (!(bom[0] == (byte) 0xEF && bom[1] == (byte) 0xBB && bom[2] == (byte) 0xBF)) {
        pushbackInputStream.unread(bom);
    }
 }
 return pushbackInputStream; 
}

Upvotes: 0

Sergey Glotov
Sergey Glotov

Reputation: 20356

You have invisible character in these lines, \8232 is line separator. Possibly you copied it somewhere.

Try to paste it in Notepad/TextEdit and copy text from there. Point is to get rid of formatting and extra characters. Or you can just delete these lines and retype them manually.

Upvotes: 5

Related Questions