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

explain local datetime api in java8?

561


What is time complexity java?

541


What are features of java?

562


How do we access static members in java?

630


What are the four corner stones of oop?

549






What are the advantages of user defined functions?

560


What is the purpose of the runtime class in java programming?

570


What is indexof in java?

519


How can you handle java exceptions?

531


How do you create a method in java?

547


How will you calculate the depth of a binary tree if the tree contains 15 nodes?

602


What is a stack class in java ?

614


What is a lock or purpose of locks in java?

596


Difference between process and thread?

608


Can final class have constructor?

503