4804109149 4804109149
  • 02-04-2020
  • Computers and Technology
contestada

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

(This is Java Programming btw)

Respuesta :

1johnbaker
1johnbaker 1johnbaker
  • 02-04-2020

Answer:

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<Double> 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

   }

}

Answer Link

Otras preguntas

Which period was the “golden age of dinosaurs”? a. the Triassic Period b. the Jurassic Period c. the Cretaceous Period d. the Tyrannosaurus Period
Which of the allies suffered the greatest losses on D-Day
A tree was chopped down and cut up in a local forest.The tree changed in shape.What kind of change took place?A.chemical changeB.physical change C.phase changeD
Please I have the answers I just want to double check them and Solvekey: B=42  A=93  N=29  X=361. (b-7)(2b-7)2. (4a-4)(5a-7)3. (5n-6)(4n+7)4. (2n=8)(8n+3)5. (6x
how do day and nightat uranus's equator change asthe uranus revolves around the sun?
what does etymology study?
Can someone please help me ?
A circular pool is ten feet in diameter and five feet deep. What is its volume, in cubic feet?
What are abiotic factors of the enviroment lynx
What are abiotic factors of the enviroment lynx