- merge two - TopicsExpress



          

- merge two arrays -------------------------------------------------------------------------- This example shows how to merge two arrays into a single array by the use of list.Addall(array1.asList(array2) method of List class and Arrays.toString () method of Array class ------------------------------------------------------------------- import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { public static void main(String args[]) { String a[] = { M, O, H }; String b[] = { W, M }; List list = new ArrayList(Arrays.asList(a)); list.addAll(Arrays.asList(b)); Object[] c = list.toArray(); System.out.println(Arrays.toString(c)); } } ---------------------------------------------------------------- #JAVA #arrays #ITSM
Posted on: Sat, 20 Dec 2014 14:07:49 +0000

Trending Topics



Recently Viewed Topics




© 2015