class MyString implements Cloneable {
  private String s;
  public MyString(String str) { s = str; }
  public String toString() { return s; }
  public void concatenate(String str) { s += str; }
  public Object clone() { return new MyString(s); }
}

public class ch12ex1 {
  static MyString f(MyString s) {
    s.concatenate(" plus me!");
    return s;
  }
  static MyString g(MyString s) {
    s = (MyString)s.clone();
    s.concatenate(" plus me too!");
    return s;
  }
  public static void main(String[] args) {
    MyString s1 = new MyString("Howdy 1");
    MyString s2 = new MyString("Howdy 2");
    System.out.println("Before: s1=" + s1 + ", s2=" + s2);
    System.out.println(f(s1));
    System.out.println(g(s2));
    System.out.println("After: s1=" + s1 + ", s2=" + s2);
  }
}


