Problem : Step 1 - CODING Create a text file c:\sunilos\TestCollection.java and copy below contents. import java.util.*; import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable; /* * A program of collection. */ public class TestCollection { /** * @param args */ public static void main(String[] args) { ArrayList v = new ArrayList(); v.add("Manish"); v.add("Rajnish"); v.add("Rakesh"); Integer i = new Integer(5); v.add(i); Integer value = (Integer) v.get(3); System.out.println("3 value is " + value); for (int j = 0; j < v.size(); j++) { System.out.println(j + " : " + v.get(j)); } } } Step 2 - DEPLOYMENT
C:\sunilos>java TestCollection 3 value is 5 0 : Manish 1 : Rajnish 2 : Rakesh 3 : 5 <<Previous | Next>> |