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 do you allocate memory to object?

0 Answers  


What is the difference between DataInputStream and BufferedReader

2 Answers   Hexagon,


What are the files generated after using IDL to java compiler?

0 Answers  


What is class??

0 Answers   Tech Mahindra,


What is a double vs float?

0 Answers  






Which one will take more memory: an int or integer?

0 Answers  


What is the difference between an argument and a parameter?

0 Answers  


Can a class extends itself in java?

0 Answers  


What are class members by default?

0 Answers   Hexaware,


What are wrapper classes in java?

0 Answers  


What is dynamic binding?

2 Answers  


What is the purpose of the finally clause of a try-catch-finally statement in java programming?

0 Answers  


Categories