Thursday, January 31, 2019

vector elementAt, hashtable.get example

package com.concretepage;

import java.util.Hashtable;
import java.util.Vector;

public class NewTest {

public static void main(String[] args) {

int arr[] = new int[] {1,2,3,4};
Vector<Integer> vector = new Vector();
Hashtable<Integer,String> hashtable = new Hashtable();
vector.addElement(1);
vector.addElement(2);
hashtable.put(1,"GODS");
hashtable.put(2, "OF");
hashtable.put(3, "I WILL");

System.out.println(arr[0]);
System.out.println(vector.elementAt(0));
System.out.println(vector.size());
System.out.println(hashtable.get(2));

}

}

No comments:

Post a Comment