Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Access Specifiers

    • 0
    • 3
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 402
    Comment on it

    Access Specifiers

    Access specifiers are used to set the visibility(scope) for class or interface or members.

    There are following access specifiers:

    1. Private.
    2. Default/friendly.
    3. Protected.
    4. Public.

    Private

    (i) Private members are declared with a keyword private.
    (ii) Private members are available only within the class.
    (iii) Private members can not be inherited.
    (iv) private keywords can be used for variables, methods or nested class.
    (v) Private members access within a class.
    (vi) private keyword can use for constructor also.

    Default

    (i) Default members are declare with no access specifier keyword.
    (ii) Default members can be accessible within a package.

    Protected

    (i) Protected members are declared with the keyword protected.
    (ii) Protected members can be access within a package also outside the package through inheritance.

    Public

    (i) Public members are declared with keyword public.
    (ii) Public members can be accessed within a package and outside a package.

    alt text

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: