Timeline for When to use default access modifier?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 8, 2014 at 12:29 | comment | added | mkalkov | A nitpick: default access != protected. It's true that it's often called "package access" though. I've even seen declarations like this one: /* package */ String field; | |
Jul 7, 2014 at 16:36 | vote | accept | Ilya Gazman | ||
Jul 7, 2014 at 16:32 | comment | added | user40980 | If Java was to change to have its ints be a 64 bit int, there is a bit code that would need to change around the 'convert this value to a string or string to an int'. The only two classes that need to deal with that are java.lang.Integer and java.lang.String. That is good encapsulation. As they are both within the java.lang package, all the changes for this would be made in one place - the java.lang.Integer class - without causing problems with the public API. | |
Jul 7, 2014 at 16:28 | comment | added | Ilya Gazman | How do you see the "single reason of change" principle feels in to "package encapsulation"? | |
Jul 7, 2014 at 16:15 | history | answered | user40980 | CC BY-SA 3.0 |