Should I use the Java public variable?
Java public variable breaks encapsulation - the core principle here is that the fields of your class are implementation details, by exposing it as a public field, you are telling everything outside that class that it is an actual piece of data that is stored by the class - something external classes don't need to…
Answered Oct 11, 2022 · 1.2K Views Read answer →