write a progam hashmap & hashtable?

Answer Posted / dileep

import java.io.*;
class Hashtable
{
public static void main (String args[])
{
Hashtable h=new hahtable();
h.add("dil");
h.add("ppp");
h.add("kkk");
System.out.println("the value of h is "+h);
System.out.println("the value of size is"+h.size());
}
}
import java.io.*;
class Hashmap
{
public static void main(String args[])
{
h.put("1","kkk");
h.put("2","ppp");
System.out.println("the value of h is"+h);
}
}
suppose if we use the haahtable then the we have to use
Enumeration concept and suppose if we use the HashMap then
we have to use Iterator concept.

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are generics important java?

726


define the terminology association.

877


What is meant by main method?

787


What is a variable declaration?

753


what are three ways in which a thread can enter the waiting state? : Java thread

780


Can an interface be defined inside a class?

754


how to open and edit XML file in Weblogic???

1776


What is the different types of functions?

775


Which is faster call by value or call by reference?

706


How does list work in java?

697


Differentiate between the constructors and methods in java?

726


Can we use string in switch case in java?

809


How to sort an array in java without using sort method?

721


Why synchronization is important?

784


Why is java so important?

873