I did mistake in writing below code but I am not getting the result of C[] as I want to see both A[] and B[] values in C[] ! As you can see in below code that i have try but not succeed.
public class ascending {
/**
* @param args
*/
//@SuppressWarnings("null")
public static void main(String[] args) {
// TODO Auto-generated method stub
int A [] = {1,2,3,4,5};
int B [] = {6,7,8,9,10};
int C[] = null;
int la = A.length;
int lb = B.length;
int lc = A.length + B.length;
System.out.print("ARRAYS in A: ");
for(int x = 0; x<la;x++){
System.out.print(" "+A[x]);
}
System.out.println(" ");
System.out.print
("ARRAYS in B: ");
for(int y=0;y<lb;y++){
System.out.print(" "+B[y]);
}
System.out.println(" ");
System.out.print("Arrays in C: ");
for(int z = 0; z<lc; z++){
System.out.print(" "+C[z]);
}
}
}
As another alternative, by making C a 2D array, you can iterate easier and no extra space will be spent.