3rd Oct 2017, 4:49 PM
Filip
Filip - avatar
2 Answers
+ 12
// The easy way is to convert the arrays into Lists, add one into another and finally convert back to an array. import java.util.*; class Program { public static void main(String[] args) { String [] Burzum = {"Hvis lyset tar oss", "Det som engang var"}; String [] Emperor = {"In the nightside eclipse", "Anthems to the Welkin at dusk"}; List<String> list = new ArrayList<String>(Arrays.asList(Burzum)); list.addAll(Arrays.asList(Emperor)); Object[] MyFavouriteAlbums = list.toArray(); System.out.print(Arrays.toString(MyFavouriteAlbums)); } } // Or, there's another method if you check out this link... https://www.tutorialspoint.com/javaexamples/arrays_merge.htm
3rd Oct 2017, 5:23 PM
Dev
Dev - avatar
+ 6
Thank you very much!
3rd Oct 2017, 6:03 PM
Filip
Filip - avatar