令牌上的 Eclipse 语法错误,删除这些令牌
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37957903/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse syntax error on tokens, delete these tokens
提问by gfan
I am new to Eclispe. I just met a problem. I copy a piece code from a website into the Eclipse. the IDE editor prompt that: Syntax error on tokens, delete these tokens
我是 Eclispe 的新手。我刚遇到一个问题。我将一段代码从网站复制到 Eclipse 中。IDE 编辑器提示:令牌语法错误,删除这些令牌
I am sure that my code is OK. If I manually input the code, it's ok. I open the java file from Notepad++. I found there are some blank spaces(green highlighted). If I remove the green highlighted blanks, the Eclipse errors is gone.
我确定我的代码没问题。如果我手动输入代码,就可以了。我从 Notepad++ 打开 java 文件。我发现有一些空格(绿色突出显示)。如果我删除绿色突出显示的空白,Eclipse 错误就会消失。
I post some images. I googled for a while, but I didn't find useful information, so I seek help here.
我发布了一些图片。我用谷歌搜索了一段时间,但没有找到有用的信息,所以我在这里寻求帮助。
What are those blank spaces? How to eliminate the error when copying? Why does this happen?
那些空白是什么?如何消除复制时的错误?为什么会发生这种情况?
回答by Dang Cong Duong
Please remove red space, and press Tab again.
请删除红色空格,然后再次按 Tab。
回答by Sachin
Avoid copy pasting code from any other place. Type in the code by yourself, it will help because the problem of non-breaking spaces will not occur.
避免从任何其他地方复制粘贴代码。自己输入代码,它会有所帮助,因为不会出现不间断空格的问题。
回答by Ajay Takur
Just cut the code from eclipse save the file and then open compose gmail and paste it and copy same come back to eclipse and paste and save the file.
只需从 eclipse 中剪切代码保存文件,然后打开 compose gmail 并粘贴它,然后将其复制回 eclipse 并粘贴并保存文件。