Menu
Question Index
...

Write a program to convert double list to double array.

Input(Double List) Output(Double Array)
[10.23, 20.34, 34.32, 56.78, 90.56, 123.89] {10.23, 20.34, 34.32, 56.78, 90.56, 123.89}
[-123.45, -562.32, -147.21, -523.12, 452.41, -254.12] {-123.45, -562.32, -147.21, -523.12, 452.41, -254.12}
[] {EMPTY LIST} null
null {NULL LIST} null


import java.util.*;
class ConvertDoubleListIntoDoubleArray
{
    public static void main(String s[])
    {
        ArrayList<Double> doubleList = new ArrayList<Double>();
        doubleList.add(12.34);
        doubleList.add(32.64);
        doubleList.add(43.78);
        doubleList.add(56.91);
        doubleList.add(98.56);
        double[] result = convertDoubleListToDoubleArray(doubleList);
        System.out.println("The converted double array");
        for(double inputData : result)
        {
            System.out.println(inputData);
        }

    }


        public static double[] convertDoubleListToDoubleArray(List<Double> inputList)
        {
            double[] result = null;
            return result;
        }

}

Doubts

Problems

Topic: Java ArrayList

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App