Pergunta de entrevista da empresa Infosys

What is the difference between StringBuffer and StringBuilder in Java, and how would you choose between them? Additionally, explain why StringBuffer is less preferred in modern Java applications