// Looks non-static and non-final, but isn't! public int x = 1; // Looks default, non-static, non-final, but isn't! int x = 1; // Does't show public or final static int x = 1; // Doesn't show public or static final int x = 1; // Doesn't show final public static int x = 1; // Doesn't show static public final int x = 1; // Doesn't show public static final int x = 1; // What you get implicitly public static final int x = 1;
Any combination of the required (but implicit) modifiers is legal, as is using no moddifiers at all! On the exam, you can expect to see questions you won't be able to answer correctly unless you know, for example, that an interface variable is final and can never be given a value by implementing (or any other) class.
Refrence: SCJP Sun® Certified Programmer for Java™ 6 Study Guide Exam (310-065)
No comments:
Post a Comment