Menu
Question Index
...

Write a program to remove the first element from given input by using List interface methods.

Input (LinkedList) Output (LinkedList)
[Lion, Tiger, Cat, Rabbit, Mouse] [Tiger, Cat, Rabbit, Mouse]
[Suman, Sekhar, Rohan, Sukumar, Praneeth, Prakash] [Sekhar, Rohan, Sukumar, Praneeth, Prakash]
[1, 2, 3, 4, 5, 6] [2, 3, 4, 5, 6]
null null


import java.util.*;
class RemoveFirsElement
{
    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("After removing: " + removeFirstElement(input));

    }


    public static LinkedList removeFirstElement(LinkedList<String> input) {
    }

}

Doubts

Problems

Topic: Java LinkedList

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App