What is access modifiers?



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

Post New Answer

More Core Java Interview Questions

How to declare unique ArrayList ?

6 Answers   RMSI,


how your day start in your company

1 Answers  


How do you know if a value is nan?

0 Answers  


what is mena by object block any what is the use of that

0 Answers   CGI,


Can we override private method in java?

0 Answers  






Is string is a data type in java?

0 Answers  


What is lazy initialization in java?

0 Answers  


What is the += operator called?

0 Answers  


What is garbage collection in Java, and how can it be used ?

32 Answers   Accenture, HCL, Infosys, Sara, SITS, TCS, Wipro,


what is difference between type 4 driver and type 1 driver?

2 Answers   CMC, CTS, IBM, JK Technosoft, Napier Healthcare,


Can java run on google chrome?

0 Answers  


Write a program to check string is palindrome without using loop?

0 Answers   Cyient,


Categories