Java Arraylist add Example
ArrayList class add method example. This example shows you how to use add method.
ArrayList class add method example.public boolean add(List 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 ArrayList class in java.util package
* version 14 May 2008
* author Rose India
*/
import java.util.*;
public class Add {
public static void main(String args[]) {
List arrlist = new ArrayList();
int i = 0;
String str = "Rose India";
//Add the specified element to the end of this list.
arrlist.add(i);
arrlist.add(str);
System.out.println("arrlist = " + arrlist);
}
} |
|