Related Examples
 

Java LinkedList get Example

LinkedList class get method example. This example shows you how to use get method.


LinkedList class get method example.public LinkedList get(int index) Returns the element at the specified position in this list.

Here is the code

/**
 * @ # Get.java
 * A class repersenting use to get method of LinkedList class in java.util package
 * version 15 May 2008
 * author Rose India 
 */
import java.util.*;

public class Get {

    public static void main(String args[]) {
        List list = new LinkedList();
        int i = 0;
        String str = "Rose";

        //Add the specified element to the end of this list.
        list.add(i);
        list.add(str);
        list.add("India");

        System.out.println("Element of LinkedList on 1st position = " + list.get(1));
    }
}

Output
Element of LinkedList on 1st position = Rose

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US