What will be the output of the following program?
import java.io.*;
public class AddAppendConcat {
public static void main(String[] args) throws IOException {
new A().append("Mat").append("Bet").append("Spirit", 3, 2).print().append(' ').append("Campuit", 0, 3).append("replusit").append('s').print();
}
}
class A implements Appendable {
static int count;
String output = "";
public A append(CharSequence arg0) throws IOException {
output += arg0.charAt(count++);
return this;
}
public A append(char arg0) throws IOException {
output += arg0;
return new A();
}
public A append(CharSequence arg0, int arg1, int arg2) throws IOException {
output += arg0.subSequence(arg1, arg1 + ++count);
return this;
}
A print() {
System.out.print(output);
return this;
}
}