- 论坛徽章:
- 0
|
public class ArrayCopy
{
public static void main(String arg[])
{//new three string-array
char str1[]={'M','y',' ','S','t','r','i','n','g'};
char str2[]=new char[20];
char str3[]=new char[20];
System.out.println("str1: "+str1);//为什么和下一句有区别
System.out.println(str1);
str2=str1;
System.out.println("str2: "+str2);
System.arraycopy(str1,3,str3,0,str1.length-3);
System.out.println("str3: "+str3);
System.out.println(str3);
str1[3]='k';
System.out.println("\nstr1[3]='k'");
System.out.print("str3: "+str3);
}
} |
|