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 / ankit porwal

public: &#9835;
a method or field defined by public is accessible by all
other methods and fields of that program anywhere.
private: &#9835;
u can't access the private members or methods outside the
class they are only accessible inside the class.
eg: if u have "org.iitk.ankit.abc.java;" and another file in
the package "org.iitk.ankit.xyz.java;".
in this case u can't access the private methods of abc.java
class in the xyz.java file's calsses.
protected: &#9835;
in case of protected u can access the protected members in
the same package but can't access outside that package.
eg: means u can access members of abc.java in xvz.java.
b'coz they are in the same directory.
but not accessible in iitk directories files.
for more detail contact me at
email: crystal.brawal@gmail.com

Is This Answer Correct ?    24 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is function and method in java?

913


Why method overriding is used?

1031


Why is a constant variable important?

900


What is the difference between stored procedure & function?

930


Does google use java?

917


How we can run a jar file through command prompt in java?

916


What is the differences between heap and stack memory in java? Explain

935


Is void a type?

934


What is the difference between JDK and JVM?

1193


What is the primitive type byte?

944


what are synchronized methods and synchronized statements? : Java thread

954


When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

950


What is included in core java?

1007


Does java isempty check for null?

959


Explain the importance of thread scheduler in java?

959