public class Index { public IndexData head; public Index() { head = new IndexData(' '); } public void add(String s) { IndexData refhead = this.head; IndexData ref = this.head; for(int i = 0;i < s.length();i++) { ref = new IndexData(s.charAt(i)); refhead.addChild(ref); ref = refhead; } } public static void main(String args[]) { Index head = new Index(); head.add("‚²‚Ä‚¢‚·"); System.out.println(head.head.getChild().getID()); // System.out.println(dat.getID()); } }