eclipse 语法错误,插入“EnumBody”完成EnumDeclaration
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5314410/
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
Syntax error, insert "EnumBody" to complete EnumDeclaration
提问by Conor
I'm doing the following tutorial: http://developer.android.com/resources/tutorials/views/hello-listview.html.
我正在做以下教程:http: //developer.android.com/resources/tutorials/views/hello-listview.html。
When I try to create the array of Strings I get the error in the heading:
当我尝试创建字符串数组时,标题中出现错误:
Syntax error, insert "EnumBody" to complete EnumDeclaration
语法错误,插入“EnumBody”完成EnumDeclaration
It appears on the tenth last element. I thought maybe it was a size issue, so deleted ten, but then it appeared on the tenth last of the new list.
Anyone know what is the cause?
它出现在倒数第十个元素上。我想可能是尺寸问题,所以删除了十个,但后来它出现在新列表的倒数第十个。
有谁知道是什么原因?
回答by Marc
In my case I was building an app using the Notepad tutorial as a starting point. Referencing the Notepad tutorial, the class constructors are decorated with @Override directives.
就我而言,我正在使用记事本教程作为起点构建一个应用程序。参考记事本教程,类构造函数用@Override 指令装饰。
One of my @Override was generating the aforementioned error due to an errant semicolon terminating the line. Removing the semicolon, that is to say "@Override" instead of "@Override;" resolved the issue for me.
由于错误的分号终止了该行,我的@Override 之一产生了上述错误。去掉分号,即用“@Override”代替“@Override;” 为我解决了这个问题。
回答by Sahil Handa
I had the same error. You might have declared the string array outside the class declaration. Changing that fixed it.
我有同样的错误。您可能已经在类声明之外声明了字符串数组。改变它修复了它。
回答by Omphaloskopie
I had this Problem, when I by accident declared an Enum with quotation marks
我遇到了这个问题,当我不小心用引号声明了一个枚举时
public enum Environment {
"WINDOWS", "LINUX";
}
instead of
代替
public enum Environment {
WINDOWS, LINUX;
}
It took me a while to see that...
我花了一段时间才看到...