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

若如初见. 提交于 2019-12-12 18:13:39

问题


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

what are these??

screenshots:

error in code

error in Messages


回答1:


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.




回答2:


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; 
}


来源:https://stackoverflow.com/questions/33146115/what-does-an-unexpected-token-mean-and-can-i-solve-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!