Ask Question
21 November, 14:59

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. 21 November, 18:34
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers