What is access modifiers?
Answer / sumit pal singh
In java there are four type of access modifier.
1.private:It is accessible only within the class.
2.default:If you don't use any modifier then it is treated as default bydefault .it is accessible within package.
3.protected:The protected access modifier is accessible within package and outside the package but through inheritance only.
4.public:The public access modifier is accessible everywhere. It has the widest scope among all other modifiers.
The access Modifier in java specify the scope of data member,method,constructor and class.
| Is This Answer Correct ? | 2 Yes | 1 No |
How list contains works in java?
why an outer class cannot be declared as private?
What are the different types of inheritance in java?
What is the use of default method in interface in java?
What is a void method?
What is difference between compatible and incompatible changes in serialization?
Is map ordered in java?
Are true and false keywords?
What is the difference between constructor and method?
How is a structure different from array ?
Explain purpose of sleep() method in java?
Does list maintain insertion order java?