Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cannot reduce visibility of private methods
public class VisibilityTest {
interface I {
private void foo(int x) {}
private void bar(int x) {}
}
interface J extends I {
void foo(int x); // Valid: public abstract method with the same signature as a private method in super type is allowed.
default void bar(int x) {} // Valid: public default method with the same signature as a private method in super type is allowed.
}
interface K extends J {
private void foo(int x) {} // Invalid: attempting to assign weaker access privileges
private void bar(int x) {} // Invalid: attempting to assign weaker access privileges
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.