Difference between a public and a non-public class

Difference between a public and a non-public class.

A class with access specifier ‘public’ can be accessed across the packages. A package is like a folder in GUI based operating systems. For example, the “public class String” class is a public class which can be accessed across the packages.

A non-public class is a class without public access specifier. A class without access specifier or with “protected” access specifier is called non-public classes.

If a class is specified protected access can be accessed in other packages but only by the subclasses. The class without access specifier can be accessed only within the package.
What is Bootstrap, Extension and System Class loader in Java?
What is Bootstrap, Extension and System Class loader? - The Bootstrap class loader loads key Java classes. Bootstrap class loader loads the basic classes from......
Define JDBC
Define JDBC - The JDBC API defines interfaces and classes for making database connections. Using JDBC, you can send SQL....
Describe JDBC Architecture in brief.
Describe JDBC Architecture in brief. - Java application calls the JDBC library that loads a driver which talks to the database....
Post your comment