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

How would you dynamically allocate memory to an array?

580


What do you mean by light weight and heavy weight components?

547


What is one third plus one third as a fraction?

477


What is a arraylist in java?

549


What mechanism does java use for memory management?

484






What is a pattern what is an anti pattern?

499


What are implicit objects in java?

542


What is thread count in java?

538


Is it possible for a yielded thread to get chance for its execution again?

504


What are different types of multitasking?

536


What is finally in Java?

569


Can we restart a thread already started in java?

574


Can inner class be public in java?

538


What is a null point?

550


What is boolean strategy?

618