whats the deference between public and private | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

whats the deference between public and private

18th Sep 2016, 4:47 PM
Adulkhaliq Q Hamad
Adulkhaliq Q Hamad - avatar
2 Answers
+ 2
The public access modifier means that particular class,field,constructor,method is visible and accessible to every other class ( outside world ). The private access modifier means that particular field,method is only visible and accessible within the class its defined in.
18th Sep 2016, 5:05 PM
Ousmane Diaw
+ 1
public means any class any method can access to it and private means only the class in which it is present can be accessed
18th Sep 2016, 8:51 PM
Chetan Rohilla
Chetan Rohilla - avatar