Skip to content

Instantly share code, notes, and snippets.

@webcane
Last active December 15, 2015 20:48
Show Gist options
  • Select an option

  • Save webcane/5320906 to your computer and use it in GitHub Desktop.

Select an option

Save webcane/5320906 to your computer and use it in GitHub Desktop.
EclipseEnumTest - Eclipse compile code but haven't
public class EnumTest {
enum Day {
// The constructor EnumTest3.Day(int) is undefined
Monday(1), Sunday(2)
};
public static void main(String[] args) {
Day d = null;
System.out.println(d.Monday);
}
}
// null
@webcane

webcane commented Apr 5, 2013

Copy link
Copy Markdown
Author
  1. Eclipse javac compile it and produce for console : null
  2. console javac haven't compile it : c:\src\enum_\inner>javac EnumTest.java
    EnumTest.java:6: error: constructor Day in enum Day cannot be applied to given t
    ypes;
    Monday(1), Sunday(2)
    ^
    required: no arguments
    found: int
    reason: actual and formal argument lists differ in length
    EnumTest.java:6: error: constructor Day in enum Day cannot be applied to given t
    ypes;
    Monday(1), Sunday(2)
    ^
    required: no arguments
    found: int
    reason: actual and formal argument lists differ in length
    2 errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment