What are the differences between, public,private and public specifiers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

What are the differences between, public,private and public specifiers

3rd Apr 2018, 6:44 AM
Hethal
Hethal - avatar
4 Answers
+ 21
These 3 are access modifiers... If a class property is declared : public: it can be used anywhere in the program.. protected: it can be used in the same class & derived class... private : it can only be used in the class it is declared u can find examples here 👇 https://www.geeksforgeeks.org/access-modifiers-java/ https://www.sololearn.com/learn/Java/2156/?ref=app
3rd Apr 2018, 6:59 AM
🌛DT🌜
🌛DT🌜 - avatar
+ 2
🌛DT🌜 You also have the access modifier: "package"
3rd Apr 2018, 7:02 AM
***
*** - avatar
0
Try to search for "Access Modifiers" :). They declare where your class, method or variable can be used in your program.
3rd Apr 2018, 6:49 AM
***
*** - avatar
0
these are the Access modifier in java, private access able within class, Public is access everywhere
8th Jun 2018, 6:26 PM
Nilamani