[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Enum Declaration Error

Posted on 2009-05-19
1
Medium Priority
?
3,055 Views
Last Modified: 2013-12-15
I am using Eclipse Platform Version: 3.4.1 and Java build 1.5.0_02-b09. When I try to build the following ENUM declaration code using the eclipse. I am getting the errors listed below the code.

public interface Constant {
    public enum Info {
            private int index;

        Info(int index) {
            this.index = index;
        }

        INFO1(4),
        INFO2(5),
        INFO3(6),
        INFO4(7),
        INFO5(8),
        INFO6(9),
        INFO7(10);
    }
}

Return type for the method is missing
Syntax error on token ",", @ expected
Syntax error on token ",", @ expected
Syntax error on token ",", @ expected
Syntax error on token ",", @ expected
Syntax error on token ",", @ expected
Syntax error on token ",", @ expected
Syntax error on token "INFO1", AnnotationName expected
Syntax error, insert ";" to complete ConstructorDeclaration
Syntax error, insert ")" to complete ConstructorDeclaration
Syntax error, insert ")" to complete SingleMemberAnnotation
Syntax error, insert "}" to complete EnumBody
Syntax error, insert "Identifier (" to complete ConstructorHeaderName
Syntax error, insert "Identifier" to complete EnumConstantHeaderName

Thanks,
Rameshbabu Arjuna Rajan
0
Comment
Question by:arjunarajan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
Bart Cremers earned 1200 total points
ID: 24419884
Your enums should go before the class body:
public enum Info {     INFO2(5),
        INFO1(4),
        INFO3(6),
        INFO4(7),
        INFO5(8),
        INFO6(9),
        INFO7(10);
 
        private int index;
 
        Info(int index) {
            this.index = index;
        }
 
       }

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question