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

Explain the init method?

983


Difference between ‘>>’ and ‘>>>’ operators in java?

1122


what is encapsulation in java? Explain

1105


Are arrays passed by reference in java?

912


What is the difference between a field variable and a local variable?

1103


What is finalize method?

1105


What is a finally block?

973


What is difference between iterator access and index access?

1055


What is meant by memory leak?

1065


How do you add an arraylist to an array in java?

972


Realized?

2184


What is structure of java heap? What is perm gen space in heap?

1122


Why we do exception handling in java and how many types of exceptions are there?

1114


What does the three dot emoji mean?

1116


What does I ++ mean?

1061