Today in the "Graphic design mode", there is a problem "the string class with the final decoration, so that it can not be inherited (extended), which violates the open and closed principle, what is the justification for doing so?" ”
The answer is efficiency and security .
The first is efficiency, because the string class is basically one of the most frequently used classes, and if used poorly, there is a noticeable performance problem. So I made it into the final class altogether. There are many optimizations that can be done in the JVM (such as being reused in stacks), similar to StringBuilder,
String[str??] DetailXBasic TranslationN. Line, string, line Vt. To make a row, string, stretch, straighten VI. To form a string of N. (String) name of person; (DE) Sterling; (Sweden) SterlingNetwork explanationString: String Quartet: String Quartet string instrument: stringed instrument
Why is the string class in Java final?