80.4k views
3 votes
How would you add the double 75.6 to the end of an ArrayList of Doubles named myDoubles?

(This is Java Programming btw)

User Fady
by
4.2k points

1 Answer

7 votes

Answer:

myDoubles.add(75.6);

Step-by-step explanation:

ArrayList<Double> myDoubles = new ArrayList<Double>();

myDoubles.add(10.8);

myDoubles.add(92.46);

myDoubles.add(75.6);

The above code creates a double ArrayList called myDoubles. We add 10.8 and 92.46 initially. After these numbers, 75.6 is added to the myDoubles using add method (You need to type the list name, ".", and the method name to add the number)

User Igor Popov
by
4.4k points