As we all know the protected
members there for inheritance (for future programmer's, not for the users of that class). On the other hand, static
is definitely for users because we cannot override it, ...or something like that.
So why they decided to allow this over the old good compile-time error? :
public class MathUtils {
protected static max(int a, int b) {
return a > b ? a : b;
}
}
Guys who downvote my question, I would appreciate if you can give me a good example from your real-wild practice, how did you used this approach to allow access to the static member in subclass of another package? Provide me with real example. I don't need much code, just a couple sentences of explanation. Thanks.