Friday, 19 March 2021

LinkedList in Java

 import java.util.*;

class CL2

{

public static void main(String[] args)

{

LinkedList<String> A1=new LinkedList<String>();

A1.add("Ram");

A1.add("Raj");

A1.add("Raman");

A1.add("Rajan");

Iterator itr=A1.iterator();

while(itr.hasNext())

{

System.out.println(itr.next());

}

}

}

No comments:

Post a Comment