java 复制字串算法

public class Copy {
public static void copy(char[] s, char[] t){
int i=0;
for(i=0; i<s.length; i++){
t[i]=s[i];
}
t[i] = '\0';
}
public static void main(String[] args) {
char[] s = new char[] {'h','e','l','l','o',',','w','o','r','l','d','!'};
char[] t = new char[15];
copy(s, t);
for(int i=0;i<t.length ;i++){
System.out.print(t[i]);
}
}
}
上一篇:Java多态性理解


下一篇:HDU2149-Public Sale