-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx04.java
More file actions
39 lines (31 loc) · 764 Bytes
/
Ex04.java
File metadata and controls
39 lines (31 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.Scanner;
import java.util.Arrays;
/**
*
* Ex 04 Cria um array que recebe varios 10 nomes e ao final ordena os mesmos
* em ordem alfabetica
*
* @author eliwelton.moreira
*
*/
public class Ex04 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int i;
String[] nomes = new String[10];
System.out.println("Informe 10 nomes: ");
for(i = 0; i < 10; i++){
nomes[i] = input.nextLine();
}
/**
* Sort Metodo que ordena os nomes do array na ordem alfabetica
*
* @param nomes Array de strings com 10 posicoes
*/
Arrays.sort(nomes);
for(i = 0; i < 10; i++){
System.out.println(nomes[i]);
}
input.close();
}
}