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] = '';
}
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]);
}
}
}
原文地址:https://www.cnblogs.com/Oraice/p/5095060.html