publicclass Main {
publicstaticvoid main(String[] a) {
StringBuilder builder = new StringBuilder("Line 1\n");
builder.append("Line 3\n");
builder.insert(0, "Line 2\n");
System.out.println(builder.toString());
builder = builder.delete(2, 6);
System.out.println(builder.toString());
}
}
/*
Line 2
Line 1
Line 3
Li
Line 1
Line 3
*/