Question: 1). Add values( 8.2, 3.1, 4.9, 5.5, 8.3, 0.2 ) to dubs arraylist in main method. 2)pass dubs arraylist to test() method and call it

1). Add values( 8.2, 3.1, 4.9, 5.5, 8.3, 0.2 ) to dubs arraylist in main method.

2)pass dubs arraylist to test() method and call it in main method

At the end, print dubs in console.

test() method will remove the first two elements in an ArrayList of doubles (be careful, this is a little tricky! :-) )

Note: You should use remove() method to remove elements

------------------

import java.util.*;

class Main { //your main method code here public static void main(String[] args) { // Creating object of ArrayList ArrayList dubs = new ArrayList(); // Populating dubs(Write Your code) // print dubs before removal System.out.println(dubs); // run the removal method test(dubs); // print dubs after removal System.out.println(dubs); } public static void test(ArrayList dubs) { //write code here } }

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!