fork download
  1. import java.util.*;
  2.  
  3. class HelloWorld {
  4. public static void main (String[] args) {
  5. String[] nomes = new String[3];
  6. Scanner scanner = new Scanner(System.in);
  7. for (int i = 0; i < 3; i++) {
  8. System.out.print("Nome: ");
  9. nomes[i] = scanner.nextLine();
  10. System.out.println();
  11. }
  12. for (int i = 0; i < 3; i++) {
  13. System.out.println("Nome: " + nomes[i]);
  14. }
  15. }
  16. }
  17.  
  18. //http://pt.stackoverflow.com/q/184408/101
Success #stdin #stdout 0.16s 37540KB
stdin
José
João
Maria
stdout
Nome: 
Nome: 
Nome: 
Nome: José
Nome: João
Nome: Maria