Friday, June 7

Merging two array values using Java

Hi All,

Here  I write a program for Merge two array values using java.


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class mergeArray {
   public static void main(String args[]) {
      String x[] = { "S", "K", "i" };
      String y[] = { "T", "E","C","H" };
      List list = new ArrayList(Arrays.asList(x));
      list.addAll(Arrays.asList(y));
      Object[] z = list.toArray();
      System.out.println("Merge two array result \n "+Arrays.toString(z));
   }
}
 
 

Output

~~~~~~ 

Merge two array result 
[S, K, i, T, E, C, H]

No comments:

Post a Comment

Backup files to google drive using PHP coding

 Dear All, To backup files to Google Drive using PHP coding, you can use the Google Drive API and the Google Client Library for PHP. Here...