Java LinkedList add Example
LinkedList class add method example. This example shows you how to use add method.
LinkedList class add method example.public boolean add(LinkedList e) Appends the specified element to the end of this list.
Here is the code
/**
* @ # Add.java
* A class repersenting use to add() method
* of LinkedList class in java.util package
* version 15 May 2008
* author Rose India
*/
import java.util.*;
public class Add {
public static void main(String args[]) {
List list = new LinkedList();
int i = 0;
String str = "Rose India";
//Add the specified element to the end of this list.
list.add(i);
list.add(str);
System.out.println("list = " + list);
}
} |
|