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

when,where and how to use abstract class and interface

2 Answers  


What is toarray method in java?

0 Answers  


use of wrapper classes?

3 Answers   IBM,


Can we instantiate interface in java?

0 Answers  


Can a class be subclass of itself?

4 Answers  






Which class is used by server applications to obtain a port and listen for client requests?

0 Answers  


what is ststic with example

0 Answers   Wipro,


What is entry in java?

0 Answers  


Difference between java and javascript

0 Answers  


StringBuilder s = new StringBuilder("Hello Mom");s.append(",I mean,Mother"); Response.Write(s.ToString()); String s = "Hello Mom"; s+ = ",I mean Mom"; Response.Write(s); Which is faster ? which uses the most memory?

6 Answers   HCL,


What are non-access modifiers?

2 Answers   Cognizant,


What is a java lambda expression?

0 Answers  


Categories