3 ms·
A related case: I have never bothered to learn, nor will I, what the default modifiers for Java’s variables and methods are. Thus, every one of those things get
by ewjordan 16y ago
A related case: I have never bothered to learn, nor will I, what the default modifiers for Java’s variables and methods are. Thus, every one of those things gets one of private or public or protected in front of it. There are way better things to load up the finite cupboard-space in my mind with.
Oh, no, man, that's not good! "Default" visibility (package-private, i.e. visible within the same package, but not outside of it) is there for a reason, and that reason is that it's not the same as public, private, or protected!
There's literally no way to specify a package-private variable without leaving the modifier off, though some people (including myself) like to write
/*package-private*/
as the visibility, just to be explicit.
Aside from that nitpick, I agree with you, though, when in doubt, be explicit, it will save you a lot of trouble in the long run.