What is access modifiers?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Where is jre installed?

763


Can a lock be acquired on a class in java programming?

693


What is a conditional statement explain with example?

724


What is a flag value?

679


Can static method access instance variables ?

782






What is super?

757


How a variable is stored in memory?

689


If I only change the return type, does the method become overloaded?

704


What are the four corner stones of oop?

733


What are instance variables?

768


Does java initialize arrays to zero?

678


What is command line argument in java?

796


what are Hostile Applets?

1768


How do I know if java is installed?

729


Why collection is called framework in java?

695