Home / Questions / What will be the output of the following code snippet when combined with suitable declarations and run ?
Explanatory Question

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

👁 23 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation


StringBuffer city = new StringBuffer ("Madras");

StringBuffer string = new StringBuffer();

string.append(new String(city));

string.insert(0, "Central");

String.out.println(string);

Output:


CentralMadras.