Create List For Given Elementselements never be null or empty string - Java Quiz Question


Write a program to create list for given elements.

Input Elements(Strings) Output List
Apple, Orange, Banana, Pineapple, Mango, Sapodilla, Watermelon, Custard Apple [Apple, Orange, Banana, Pineapple, Mango, Sapodilla, Watermelon, Custard Apple]
MPC, BIPC, HEC, CEC, MEC [MPC, BIPC, HEC, CEC, MEC]
MPC, BIPC, "", CEC, "" [MPC, BIPC, CEC]
MPC, null, HEC, null, MEC [MPC, HEC, MEC]
"", "", "" []
null, null, null []


import java.util.*;
class CreateListForGivenElements
{
    public static void main(String s[])
    {
        List<String> result = createListForGivenElements("Apple", "Orange", "Banana", "Pineapple", "Mango", "Sapodilla", "Watermelon", "Custard Apple");
        System.out.println("The elements in list "+result);

    }


        public static List<String> createListForGivenElements(String... elements)
        {
        List<String> result = null;
            return result;
        }

}