Skip to content

Instantly share code, notes, and snippets.

@martijndwars
Created March 18, 2020 13:35
Show Gist options
  • Save martijndwars/d654283355e339b4af5cf8663ea5b878 to your computer and use it in GitHub Desktop.
Save martijndwars/d654283355e339b4af5cf8663ea5b878 to your computer and use it in GitHub Desktop.
isEnum?
public class Main {
public enum Days {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,
SATURDAY {
public String toString() {
return "Samstag";
}
};
}
public static void main(String[] args) {
System.out.println(Days.class.isEnum()); // true
System.out.println(Days.SUNDAY.getClass().isEnum()); // true
System.out.println(Days.SATURDAY.getClass().isEnum()); // false
}
}
@martijndwars
Copy link
Author

> javac Main.java; java Main
true
true
false

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