+1 vote
in JAVA by
When to use abstract class and interface in java?

1 Answer

0 votes
by

When to use abstract class and interface in java?

Java provides four types of access specifiers that we can use with classes and other entities.

These are:

#1) Default: Whenever a specific access level is not specified, then it is assumed to be ‘default’. The scope of the default level is within the package.

#2) Public: This is the most common access level and whenever the public access specifier is used with an entity, that particular entity is accessible throughout from within or outside the class, within or outside the package, etc.

#3) Protected: The protected access level has a scope that is within the package. A protected entity is also accessible outside the package through inherited class or child class.

#4) Private: When an entity is private, then this entity cannot be accessed outside the class. A private entity can only be accessible from within the class.

Related questions

0 votes
asked Apr 30, 2021 in JAVA by rajeshsharma
+1 vote
asked Jun 16, 2019 in JAVA by reins.robin
...