Is there any difference between default (package) and public access level of methods in class with default (package) access level?
java, oop
Solution
There is a difference when you subclass Foo:
public class Bar extends Foo {
}
then try in another package:
new Bar().getIntProperty ()
It will compile at the second of your examples (all methods public) but not at the first (all methods default access)
Problem
The same question in code: ``` class Foo { int getIntProperty () { ... } CustomObject getObjectProperty () { ... } void setIntProperty (int i) { ... } void setObjectProperty (CustomObject obj) { ... } //any other methods with default access level } ``` VS ``` class Foo { public int getIntProperty () { ... } public CustomObject getObjectProperty () { ... } public void setIntProperty (int i) { ... } public void setObjectProperty (CustomObject obj) { ... } //any other methods with public access level } ```