KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
public class Parent { public enum ChildType { FIRST_CHILD("I am the first."), SECOND_CHILD("I am the second."); private String myChildStatement; ChildType(String myChildStatement) { this.myChildStatement = myChildStatement; } public String getMyChildStatement() { return this.myChildStatement; } } public static void main(String[] args) { // Why does this work? System.out.println(Parent.ChildType.FIRST_CHILD.myChildStatement); } } Are there any additional rules with regard to access control for Parent subclasses, classes within the same package, etc., in reference to this enum? Where might I find those rules in the spec?
Tags (comma-separated)
Save Edits
Cancel