Top 20 Java Interview Questions
Q.1. Can you elaborate on the distinctions between StringBuffer and StringBuilder? Explanation: StringBuffer: StringBuffer and StringBuilder classes are mutable.StringBuffer is synchronized i.e. thread safe. It means two threads can’t call the methods of StringBuffer simultaneously. StringBuffer is less efficient than StringBuilder. StringBuilder: StringBuilder is non-synchronized i.e. not thread safe. It means two threads can call the methods …