What will be the output of the following code snippet when combined with suitable declarations and run ?

Short Answer
Views 19

Answer:


StringBuffer city = new StringBuffer ("Madras");

StringBuffer string = new StringBuffer();

string.append(new String(city));

string.insert(0, "Central");

String.out.println(string);

Output:


CentralMadras.

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.