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 are internal and external variables?

959


Why put method is used?

1016


Difference between Linked list and Queue?

1030


what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent

2183


Is a string literal?

1102


What is java reflection api?

1021


Is there any tag in htm to upload and download files?

1047


What is the static field modifier?

1132


What is the protected method modifier?

1049


How do you clear a method in java?

1012


When can we say that threads are not lightweight process in java?

1159


Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?

1032


Why is a constant variable important?

961


What are multiple inheritances? Is it supported by java?

952


what is the use of bean managed and container managed with example?

1978