Java LinkedList offerLast Example
LinkedList class offerLast method example. This example shows you how to use offerLast method.
LinkedList class offerLast method example.public boolean offerLast(LinkedList e) Inserts the specified element at the end of this list.
Here is the code
/**
* @ # OfferFirst.java
* A class repersenting use to offerFirst method of LinkedList class in java.util package
* version 15 May 2008
* author Rose India
*/
import java.util.*;
public class OfferFirst {
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.offerFirst("India");
//Adds the specified element as the forst on the list
System.out.println("list = " + list);
}
} |
|