+ 1
Different between private public in java
java
2 ответов
+ 2
There are 4 different access modifiers in Java.
1) public
Visible to any class in any package.
2) private
Visible only in the defining class
3) protected
Visible in the defining class and all inherited classes
4) default
Visible in the same package.
Visibility means, that the variable or class can be seen or modified over the dot notation.
+ 1
private cannot be accessed outside class and public can be accessed, is that the difference