Menu
Question Index
...

Write a program to get the sub list from the given inputs by using one of the List interface methods.

Input (List, int, int) Output (List)
[Lion, Tiger, Cat, Rabbit, Mouse], 0, 3 [Lion, Tiger, Cat]
[Rose, Jasmine, Lotus, Peacock, Cassia], 0, 5 [Rose, Jasmine, Lotus, Peacock, Cassia]
[1, 2, 3, 4, 5, 6], 6, 6 []
[Red, Blue, Green, White, Black, Pink], 5, 1 null
Bold, Thick, Thin, Dotted], -1, 3 null
[Mercedes, Audi, Ferrari, BMW, Ford], 4, -1 null
null, 1, 2 null


import java.util.*;
class GetSubList
{
    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("Sublist is: " + getSubList(input, 0, 3));

    }


    public static List getSubList(List<String> input, int start, int end) {
    }

}

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