bom esse é oenunciado:
Construa uma aplicação em Java que receba 2 vetores com 5 números inteiros cada.
Faça a intercalação dos 2 vetores em um vetor resultante e imprima seus valores.
Ordene o vetor de forma decrescente e imprima seus valores.
e ese ocodigo que saiu até agora.
public class Exercicio5B {
public static void main(String[] args) {
int x[] = new int[5];
int y[] = new int[5];
int k[] = new int[10];
for (int i = 0; i < 5; i++) {
x[i] = Integer.parseInt(JOptionPane.showInputDialog("Digite o " + (i + 1) + "º numero"));
k[i] = x[i];
}
for (int j = 0; j < 5; j++) {
y[j] = Integer.parseInt(JOptionPane.showInputDialog("Digite o " + (j + 1) + "ºnumero"));
k[j+1] = y[j];
}
//aqui esta a minha duvida como posso fazer o vetor k[] = x[i], y[i],x[i+1], y[i+1]......???
int aux;
for (int i = 0; i < (x.length - 1); i++) {
for (int j = i + 1; j < y.length; j++) {
if (y[j] > x[i]) {
aux = x[i];
x[i] = y[j];
y[j] = aux;
}
}System.out.println(k);
}
}
}
alguem pode me ajudar