Can anyone generalize the visibility options for Java interfaces?
3 answers
1) when the interface is only needed in the scope of your package. For example, an interface can make your code more readable, but the packages that call it don't need it.
2) No, this is impossible. For more information see the link. Interface does not define implementation. How could you close it for implementation?
+5
a source to share
1) You may have utility methods used by multiple classes in your package that should never be called externally. Or, only one class may need them, but the class is so large that you want to move some of the methods to another class for ease of maintenance.
2) I would have to try (sorry, I'm heading for the door now), but you could effectively do this by declaring a protected default constructor in the interface.
0
a source to share