React.js
Angular
Ethical Hacking
Agile
AWS
BlockChain
Cassandra
Cloud
Salesforce
Scaled Agile
TOGAF
DevOps
GIT
Jenkins
Jira
Kibana
Linux
NGINX
Ansible
Artificial Intelligence
in JAVA by

Difference between Default and Protected access specifiers.

Default: Methods and variables declared in a class without any access specifiers are called default.

default

Default members in Class A are visible to the other classes which are inside the package and invisible to the classes which are outside the package.

So Class A members are visible to the Class B and invisible to the Class C.

Protected:

Protected             .

Protected is same as Default but if a class extends then it is visible even if it is outside the package.

Class A members are visible to Class B because it is inside the package. For Class C it is invisible but if Class C extends Class A then the members are visible to the Class C even if it is outside the package.

Click here to read more about DevOps

Related questions

Madanswer
0 votes
asked May 24, 2019 in JAVA by rajeshsharma
0 votes
asked May 24, 2019 in JAVA by rajeshsharma
...