±Û¾´ÀÌ :Sung Yi 2000³â 2¿ù 18ÀÏ 01:01:39
In Reply to: [Áú¹®] µÎ String array¸¦ ÇÕÃÄ Çϳª·Î ¸¸µå·Á¸é... posted by ÃÖÅ¿ø on 2000³â 2¿ù 17ÀÏ 11:21:50:
The arraycopy is a COPY method. In your case, you are trying to APPEND the string array b to a. Naturally, the array a is not big enough to hold the string b plus itself.
That is,
System.arraycopy(b, 0, a, len1, len2);
//is same as ..(b, 0, a, 3, 2);
by doing this, the destination length will be greater than itself (3 + 2 = 5. This is greater than the legnth of a which is 3).
That is why you are getting the ArrayIndexOutOfBound error message.
If you want to append a string to another, you will be better off using the StringBuffer class.