I'm a beginner, too , Write it down , I didn't expect it to work .
package zhoumo.java.simple;
import java.util.Arrays;
public class Simple {
public static void main(String[] args) {
try {
int []a ={23,54,34,89,21,43,54};
int []b={1,32,45,76,46};
int len = a.length+b.length;
// Dynamically create an array to store the values of two arrays
int []c = new int[len];
for (int i = 0; i < a.length; i++) {
c[i]=a[i];
}
for (int j = 0; j < b.length; j++) {
c[a.length+j]=b[j];
}
Arrays.sort(c);
for (int i = 0; i < len; i++) {
System.out.print(c[i]+" ");
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(" Merge succeeded !");
}
}
Technology
Daily Recommendation