Me ajude nessa atividade java

0 respostas
javaprogramação
H

como faço para O MÉTODO QUE IMPRIME O VETOR SER DECLARADO COMO MÉTODO DE OBJETO
A VARIÁVEL int x[] do método main, deve ser declarada como atributo de objeto
da classe at

public class At{

public static void main(String  args){

int x[] = {1,7,3,25,24};

int arrayOrdenado[] = ordenar(x);

for(int a: arrayOrdenado){

System.out.println(a);

}

}
private static int[] ordenar(int[] x) {

int y;

for(int i=0; i<=4; i++){

for(int j=i; j<=4;j++){

if(x[i] > x[j]){

y = x[i];

x[i] = x[j];

x[j] = y;

}

}

}

return x;

}

}

Criado 26 de abril de 2020
Respostas 0
Participantes 1