To advertise with us contact on Whatsapp: +923041280395For guest post email at: [email protected]
Tag: Difference between Default and Protected access specifiers in Java
Default: Methods and variables declared in a class without any access specifiers are called 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 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.
We covered nearly 50 + primary Java interview questions in this tutorial for fresh and experienced candidates. Q.1- What is Java? Java is a high-level programming language and is platform-independent. Java is a collection of objects. It was developed by Aun