U06-04-Mostrar y ordenar una tabla

Mostrar el contenido de una tabla

int t[] = {8, 41, 37, 22, 19};
System.out.println(Arrays.toString(t));

Ordenar

int edad = {85, 19, 3, 23, 7}; //tabla desordenada
Arrays.sort(edad); //ordena la tabla. 
edad = [3, 7, 19, 23, 85];
package U6;

import java.util.Arrays;
import java.util.Scanner;

public class A000 {

	public static void main(String[] args) {
		
		int t[]= {3,54,6,54,34,6};
		
		for (int ele:t)
			System.out.println(ele);
		
		System.out.println(Arrays.toString(t));
		
		Arrays.sort(t);
		
		System.out.println(Arrays.toString(t));

	}
}

Related Posts