Ask Question
24 January, 00:23

How would you print out the value in the fourth index of an ArrayList of Doubles named myDoubles?

(This is Java Programming btw)

+4
Answers (1)
  1. 24 January, 01:02
    0
    You could make an ArrayList and get the 3rd Element in the array (Third because Arrays start at 0, making the Fourth one the third)

    Explanation:

    public class Main {

    public static ArrayList myDoubles = new ArrayList ();

    public static void main (String[] args) {

    myDoubles. add (1.0);

    myDoubles. add (2.0);

    myDoubles. add (3.0);

    myDoubles. add (4.0);

    double fourth = myDoubles. get (3);

    System. out. println (fourth); / / returns 4.0

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “How would you print out the value in the fourth index of an ArrayList of Doubles named myDoubles? (This is Java Programming btw) ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers