What is the difference between a public and a non-public class

A public class may be accessed outside of its package. A non-public class may not beaccessed outside of its package.

Showing Answers 1 - 1 of 1 Answers

A public class will have access specifier "public" and its members can be accessed with in and out of the class in which they are specified.
A class which doesnt have the public access specifier are called as non-public classes and its member can be accessed only within the class in which they are specified.We can consider private, protected, friendly classes as a non-public classes.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions