Tutorial #11: Modifier Types



  • Visible to the package, the default. No modifiers are needed.
  • Visible to the class only (private).
  • Visible to the world (public).
  • Visible to the package and all sub-classes (protected).

To use a modifier, you include its keyword in the definition of a class, method, or variable. The modifier precedes the rest of the statement.

public class className {
   // ...
}

private boolean myFlag;
static final double weeks = 9.5;
protected static final int BOXWIDTH = 42;

public static void main(String[] arguments) {
   // body of method
}

    
               

Access ModifiersVisibility
PublicVisible to All classes.
ProtectedVisible to classes with in the package and the sub-classes
 of other package.
No Access Modifier (Default)Visible to the classes with the package
privateVisible with in the class. It is not accessible outside the class.

Comments

  1. Okay...

    What I'm going to tell you may sound really creepy, maybe even kind of "strange"

    BUT what if you could simply press "PLAY" to listen to a short, "magical tone"...

    And INSTANTLY attract MORE MONEY to your life??

    And I'm really talking about BIG MONEY, even MILLIONS of DOLLARS!!

    Sound too EASY?? Think something like this is not for real???

    Well, Let me tell you the news..

    Sometimes the largest blessings in life are the SIMPLEST!!

    Honestly, I'm going to PROVE it to you by letting you listen to a real-life "miracle wealth building tone" I've synthesized...

    You simply push "PLAY" and you will start having more money come into your life. starting pretty much right away.

    TAP here now to PLAY the mysterious "Miracle Abundance Tone" - as my gift to you!!

    ReplyDelete

Post a Comment