Question

JAVA - Please describe these access modifiers in less than 2 sentences    public    private...

JAVA - Please describe these access modifiers in less than 2 sentences
   public
   private
   protected
   default

0 0
Add a comment Improve this question Transcribed image text
Answer #1

JAVA Access Specifiers:

Public: The public is the most wide-open access specifier. By using it we can make it available even outside the package without inheritance.

Private: Private is the most restricted access specifier. By using it we can make the methods or data members available only within the class itself.

Protected: Protected will make sure the data members and the methods are available only inside the package or subclass in different packages. i.e it is only available outside package the through inheritance.

Default: The Default access specifier will set the access level to within the package only. If we leave the access specifier blank then the default access specifier will be imposed.

Add a comment
Know the answer?
Add Answer to:
JAVA - Please describe these access modifiers in less than 2 sentences    public    private...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT