[java]
/**
Author :candidjava.com
Description: Returns the element at the specified position in this list.
*/
import java.io.IOException;
import java.util.*;
public class LinkedListGetExample
{
public static void main(String args[])
{
int b=60,c=20,d=30,p=1;
LinkedList l=new LinkedList();
l.add(b);
l.add(c);
l.add(d);
System.out.println(p+"th position’s element in the list is");
System.out.println(l.get(p));//returns element in the pth position
}
}
[/java]