日期:2014-05-20 浏览次数:20957 次
public class Test {
    
    public Object[] toArray(String str){
        int length=str.length();
        Object[] o=new Object[length];
        for(int i=0;i<length;i++){
            o[i]=str.charAt(i);
        }
        return o;
    }
    
    public static void main(String[] args) {
        Object[] o=new Test().toArray("fhdifhe你oia");
        for (int i = 0; i < o.length; i++) {
            System.out.print(o[i]+" ");
        }
    }
}
打印输出:f h d i f h e 你 o i a