Menu
Question Index
...

Write a program to copy the data from one list to other list.

Input(Source List, Destination List) Output
[Beans, Cabbages, Carrots, Cauliflower, Cucumbers, Onions, Radishes, Potatoes, Tomatoes, Sweet Corn]
[]
[Beans, Cabbages, Carrots, Cauliflower, Cucumbers, Onions, Radishes, Potatoes, Tomatoes, Sweet Corn]
[MEC, EEE, CIVIL, ECE, CSE, IT]
[]
[MEC, EEE, CIVIL, ECE, CSE, IT]
[]
[] {EMPTY LIST}
[]
null
null {NULL LIST}
null


import java.util.*;
class CopyDataFromOneListToOtherList
{
    public static void main(String s[])
    {
        ArrayList<String> sourceList = new ArrayList<String>();
        sourceList.add("One");
        sourceList.add("Two");
        sourceList.add("Three");
        sourceList.add("Four");
        sourceList.add("Five");
        sourceList.add("Six");
        ArrayList<String> destinationList = new ArrayList<String>();
        copyDataFromListToOtherList(sourceList, destinationList);
        System.out.println("The elements in destination list");
        for(String inputString : destinationList)
        {
            System.out.println(inputString);
        }

    }


        public static void copyDataFromListToOtherList(List<String> sourceList,  List<String> destinationList)
        {
        }

}

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