Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How does access modifiers work?

Answer Posted / javamasque

Public: It is the highest visibility access modifier. It makes visible the class members (variables/methods) to any classes (child/non-child) present within same or any package.
Protected: It has lesser visibility than public access modifier. It makes visible the class members (variables/methods) to sub-classes within same or different package and it also make visible in any class of same package.
Default: It has lesser visibility than protected access modifier. It makes visible the class members (variables/methods) to any classes within same package only.
Private: It has least visibility than all access modifiers. It makes visible the class members (variables/methods) within same class only.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what happens when a thread cannot acquire a lock on an object? : Java thread

1025


What are the types of arrays in java?

1036


What is tochararray in java?

886


Why there are some null interface in JAVA? What does it mean? Give some null interface in JAVA?

1039


Can inner class have constructor?

1000


What are parsing rules?

951


What is procedure overloading?

2250


What is a type parameter in java?

947


Which package has light weight components in java programming?

1089


What is += mean in java?

960


How can you read an integer value from the keyword when the application is runtime in java? example?

1070


What is the purpose of a volatile variable?

985


Explain illegalmonitorstateexception and when it will be thrown?

1054


Can we have return statement in finally clause? What will happen?

923


What is the purpose of java?

949