Menu
Question Index
...

Write a program to convert integer list to integer array.

Input(Integer List) Output(Integer Array)
[10, 20, 34, 56, 90, 123] {10, 20, 34, 56, 90, 123}
[-123, -562, -147, -523, 452, -254] {-123, -562, -147, -523, 452, -254}
[] {EMPTY LIST} null
null {NULL LIST} null


import java.util.*;
class ConvertIntegerListIntoIntegerArray
{
    public static void main(String s[])
    {
        ArrayList<Integer> integerList = new ArrayList<Integer>();
        integerList.add(12);
        integerList.add(32);
        integerList.add(43);
        integerList.add(56);
        integerList.add(98);
        int[] result = convertIntegerListToIntegerArray(integerList);
        System.out.println("The converted integer array : ");
        for(int inputData : result)
        {
            System.out.print(inputData + ", ");
        }

    }


        public static int[] convertIntegerListToIntegerArray(List<Integer> inputList)
        {
            int[] 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