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...

Explain the differences between public, private, protected
and static?

Answer Posted / ranganathkini

Members marked public are accessible to members of any class
irrespective of the package.

Members marked private are only accessible to other members
of the same class.

Members marked protected are only accessible to other
members of the same class, members of a subclass and members
of other classes in the same package.

Member marked static are shared by all instances of that
class and hence r not related to any specific instance of
that class. Methods marked static cannot access non-static
members or fields of that class. But non-static members can
access static fields or methods.

Is This Answer Correct ?    111 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Say any two properties in beans?

1060


how to create daemon thread in java?

1064


What is a pattern what is an anti pattern?

967


Can finally block be used without a catch?

1005


What is the difference between the ">>" and " >>>" operators in java?

983


What is the difference between variable & constant?

1017


What is integer valueof?

1098


How many bits are in a sentence?

1164


why not override thread to make a runnable? : Java thread

994


What is local declaration?

960


What are methods and how are they defined?

1204


Why to use nested classes in java?

1116


How do you implement polymorphism in our day to day life?

3230


What happens when I use / and % with a negative numerator?

1039


Is passing by reference faster?

986