Related Examples
 

Java LinkedList offer Example

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


LinkedList class offer method example. public boolean offer(LinkedList e) Adds the specified element as the tail (last element) of this list.

Here is the code

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

public class Offer {

    public static void main(String args[]) {
        LinkedList 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.offer("India");
        //Adds the specified element as the tail on the list
        System.out.println("list = " + list);
    }
}

Output
list = [0, Rose, India]

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

HOME | COPYRIGHT | CONTACT US