String aa = new String[verylong]; String bb = new String[notsolong];
// fill aa with Strings
System.arrayCopy(aa, 0, bb, 0, notsolong);
According to the API, this method is System.arrayCopy(Object src, int srcbegin, Object dest, int destbegin, int howmany) String arrays are Objects, so this should work, I think. What do I have to do? Object obOne = aa; Object obTwo = bb; or something like that???
Joined: Jan 30, 2000
Typically when something does not compile, you get an error message. The text of this message may contain useful clues about the nature of the problem. Even if you don't understand what the error message means yourself, it's useful to other people who you might ask for help. So: what does the error message say?
'arrayCopy' method name is wrong. The correct method is,
System.arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
- Marimuthu Madasamy
Joined: Oct 12, 2005
Usually I give more explanation about the error message, but this time I forgot to do that, it seems. My computer gives error messages in Japanese, so instead of copying the error message, I give it kind of an English translation.
System.arraycopy()! I can't believe I just spelled it wrong! I spelled it arrayCopy! I must have been really tired or something. Usually methods in java, when they are a compound of two or more words, have the first word in all small letters, and capitalize the other words, like Integer.intValue() etc. I thought String.substring() should be String.subString() until I thought about it and realized that sub is not really a word. But array and copy are both words, so I expected arrayCopy, not arraycopy.