You want to transfer a String into a Treecreat? You should give Treecreat a constructor like this.
public Treecreat(String yourString){
    this.myString = yourString;
}
So the String is in Treecreat and you can work with it in your method, with call the method in this way: add(new Treecreat(data). 
solved How can we convert a string to a user defined object in java [closed]