java - Can I do a static import of a private subclass? -
i have enum private, not exposed outside of class. there anyway can static import of type, don't have type enum type each time? or there better way write this? example:
package kip.test; import static kip.test.test.myenum.*; //compile error public class test { private static enum myenum { dog, cat } public static void main (string [] args) { myenum dog = myenum.dog; //this works don't want type "myenum" myenum cat = cat; //compile error, want } }
or there better way write this?
if main goals reference items without qualifying enum identifier, , maintain list privately, scrap enum
type altogether , use ordinary private static constants.
Comments
Post a Comment