2

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:

commadelimited
  • 5,656
  • 6
  • 41
  • 77
Coding John
  • 53
  • 2
  • 4
  • 18
  • 2
    Did you copy/paste code from internet ? There may be some invisible characters. – Zang MingJie Oct 15 '15 at 10:33
  • Did you copy-paste the code? [Refer](http://stackoverflow.com/questions/30808561/unexpected-token-error40-61-error-illegal-character-8232-in-android-stud) – Harish Ved Oct 15 '15 at 10:36

2 Answers2

5

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.

Sergey Glotov
  • 20,200
  • 11
  • 84
  • 98
0
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; 
}
Taras Vovkovych
  • 4,062
  • 2
  • 16
  • 21