Respuesta :

Answer:

import java.util.*;

public class ReverseNames{

public static void main(String [] args){

Scanner input = new Scanner(System.in);

String [] names = new String[3];

System.out.print("Please enter three names: ");

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

names[i] = input.next();

}

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

System.out.print(names[2-i]+" ");

}

}

}

Explanation:

This line declares array of 3 elements named names

String [] names = new String[3];

This line prompts user for three names

System.out.print("Please enter three names: ");

The following iteration gets the three names from the user

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

names[i] = input.next();

}

The following iteration prints the names in reverse order

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

System.out.print(names[2-i]+" ");

}

Answer:

import java.util.*;

public class ReverseNames{

public static void main(String [] args){

Scanner input = new Scanner(System.in);

String [] names = new String[3];

System.out.print("Please enter three names: ");

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

names[i] = input.next();

}

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

System.out.print(names[2-i]+" ");

}

}

}Explanation: