The vector or array in computer science or mathematics can be imagined as a kind of criminal, where all the fields are called cells of the array itself, Click here to read the entire article on wikipedia.
This tutorial will show you how to use the Java method System.arraycopy() to copy a vector / array in java. Il metoto System.arraycopy() allows you to copy an entire array or part thereof.
Of course, to copy the array, The destination array must have the same size (the same number of boxes) of the source.
Here is a sample Java code:
String[] source = { “cat”, “dog”, “bird” }; // Defines the source array with 3 boxes that string variables with text
String[] target = new String[sorgente.length]; // Defines the destination array with length equal to the array and vacuum source points must have the same length source and recipient
System.arraycopy(source , 0, destination , 0, sorgente.length); // Finally use the method System.arracopy giving as parameters the source array, where to begin copying, array target, the position where I put the copy and the length
Related article: java: convert a variable of type String to Date
Subscribe to my RSS feed: http://www.marcobruni.info/it/feed
Recent Comments