Remove the element at specified index - Java Quiz Question


Write a program to remove element at given index by using one of the List interface methods.

Input (List, int) Output (List)
[Lion, Tiger, Cat, Rabbit, Mouse], 1 [Lion, Cat, Rabbit, Mouse]
[Rose, Jasmine, Lotus, Peacock, Cassia], 4 [Rose, Jasmine, Lotus, Peacock]
[1, 2, 3, 4, 5, 6], 9 null
[Red, Blue, Green, White, Black, Pink], -1 null
null, 2 null


import java.util.*;
class RemoveElementAtGivenIndex
{
    public static void main(String s[])
    {
        LinkedList<String> input = new LinkedList<String>();
        input.add("Java");
        input.add("C++");
        input.add("C");
        input.add(".Net");
        input.add("Oracle");
        System.out.println("The list after removed : " + removeElementAtGivenIndex(input, 4));

    }


    public static List removeElementAtGivenIndex(LinkedList<String> input, int index) {
    }

}