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

What is the default value of the local variables?

725


What are adapter classes?

803


Is constructor inherited?

759


Discuss 2D arrays.

835


How to create a fecelet view?

790


What is difference between pointer and reference?

743


List out benefits of object oriented programming language?

682


Explain the difference between a Thread and a Process.

799


Is java a compiler?

769


Is null a value?

798


How many return statement are allowed in a function?

671


What is boolean flag in java?

811


What is variable explain?

749


What is abstraction in java?

846


What is the use of math abs in java?

761