Eclipse Enum class Error

Source: Internet
Author: User

When you write an enumeration class, if there are no enumerated values written in the first line of the enumeration class, a compile error occurs: Syntax error on token "String", STRICTFP expected

Like what:

Public enum Season2 implements Timeinfo {

Private final String name; Here is an error: Syntax error on token "String", STRICTFP expected
Private final String desc;

Private Season2 (string name, String desc) {
THIS.name = name;
THIS.DESC = desc;
}

······

}

The reason for the error is that you did not specify what enumeration values you have in the first line, and modify the following:

Public enum Season2 implements Timeinfo {

Spring,summer,fall,winter;//List The enumeration values you want to define, at which time the compilation passes

Private final String name;
Private final String desc;

Private Season2 (string name, String desc) {
THIS.name = name;
THIS.DESC = desc;
}

······

}

Eclipse Enum class Error

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.