You are on page 1of 1

import java.util.Scanner; public class inverter7nomes { public static void main(String[] args) { Scanner entrada = new Scanner(System.

in); String nomes; String vetor[] = new String[7]; for (int i = 0; i < vetor.length; i++) { // para criar os 7 nome s System.out.println("Digite um nome para preencher a posicao "+ i + " do vetor de 7 posicoes :"); nomes = entrada.next(); // mostrar os 7 nomes qu e estao sendo perguntados vetor[i] = nomes; } for(int j = vetor.length -1; j >= 0; j--) { // inverter os nomes if (j >= 1) { System.out.println(vetor[j]); // mostra eles invertidos } } } }

You might also like