Question: Write a Java method that should take an ArrayList as a parameter, print its element in the reverse order. The main function that calls the

Write a Java method that should take an ArrayList as a parameter, print its element in the reverse order. The main function that calls the method is the following:

import java.util.*;

public class ReverseGen {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

System.out.println("How many numbers do you want to input?");

int num = input.nextInt();

ArrayList d = new ArrayList(num);

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

System.out.print("Enter a double number: ");

d.add(input.nextDouble());

}

reversePrint(d);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!