13.7 Difference b/w StringBuffer and StringBuilder
Difference between StringBuffer and StringBuilder- StringBuilder class has been added in java 1.5 version.
- StringBuilder having same features like StringBuffer class.
- StringBuilder objects also mutable as StringBuffer
StringBuffer:
- Every method is synchronized.
- This object is thread safe, because it can access only one thread at a time.
- Low performance.
- Introduced in 1.0 version.
StringBuilder:
- No method is synchronized
- This object is not thread safe, because it can access multiple threads simultaneously.
- High performance
- Introduced in java 1.5 version.
- At a time one candidate is allowed to attempt the interview in interview panel.
Nireekshan