VMWare Inc Interview Question
Software Engineer in TestsExample is String class. You can change the data (not exactly strings are immutable). In certain cases, developers needs guarantee about the class. e.g. If someone inherited String class and modified behavior of some methods (substring etc), it will have side-effects on rest of the program. Hence String class is final. However you can change the content of the String itself.
final class means this class can not be inherited. if the data members are not final variables, they can be altered.
- rookie May 02, 2011