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

What is the inheritance?

1025


What is the meaning of immutable regarding string?

1010


Name four container classes.

1046


What is the abstraction?

1066


Why are there no global variables in java?

1110


whatis Home interface and Remoteinterface? with example?

2040


Difference between object and reference?

1236


Which class is the superclass for all the classes?

1065


Can inner class be public in java?

1076


how can i use a nonsynchronized hashtable?

2627


If you do not want your class to be inherited by any other class. What would you do?

1072


What is collection class in java? List down its methods and interfaces.

1033


What is a generic type?

1056


What is java util hashmap?

1035


What is the access scope of a protected method?

1080