Menu
Question Index
...

Write a program to to print the elements from given input by using the one of the Iterator interface methods.

Input (LinkedList) Printed Output
[Cat, Rabbit, Mouse, Lion, Tiger] Cat
Rabbit
Mouse
Lion
Tiger
[Rose, Jasmine, Lotus, Peacock, Cassia] Rose
Jasmine
Lotus
Peacock
Cassia
[Suman, Sukumar, Sekhar, Praneeth, Prakash] Suman
Sukumar
Sekhar
Praneeth
Prakash
null null


import java.util.*;
class PrintGivenInput
{
    public static void main(String s[])
    {
        LinkedList input = new LinkedList();
        input.add("Yellow");
        input.add("Jasmine");
        input.add("White");
        input.add("Red");
        input.add("Green");
        printInput(input);

    }


    public static void printInput(LinkedList input) {
    }

}

Doubts

Problems

Topic: Java Iterator

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App