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 does abstract modifier work?

1 Answers   Wipro,


Can we sort array in java?

0 Answers  


Can we override private constructor in java?

0 Answers  


What is basic syntax?

0 Answers  


There are two classes named classa and classb. Both classes are in the same package. Can a private member of classa can be accessed by an object of classb?

0 Answers  






Question 6 [9] 6.1 In what situations (in general) would you use a TreeMap? (3) 6.2 In what situations (in general) would you use a HashSet to store a collection of values?

1 Answers  


Can each java object keep track of all the threads that want to exclusively access it?

0 Answers  


How do you check if a character in a string is a digit or letter?

0 Answers  


What is an interoperable application in java ?

0 Answers   HCL,


Is java developer a good career?

0 Answers  


What is size of int in java?

0 Answers  


How to perform Singleton of the java class object on multi JVM?

2 Answers  


Categories