Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is Hashmap & Hashtable wirh example?

Answers were Sorted based on User's Feedback



what is Hashmap & Hashtable wirh example?..

Answer / 20/04/2008

hashmap class is not syncronized but hasTable is syncronized
. both stores key and value. hashtable is part of legasy
class we can use enumerator interface of this hashtable class.

Is This Answer Correct ?    27 Yes 3 No

what is Hashmap & Hashtable wirh example?..

Answer / rameshreddy.k

---HashTable is synchronised BUT hashmap is not synchronised
---HashTable not allow null keys and null values BUT
HashMap allow only one null key and multiple null values
---HashTable not allow Duplicate keys and Douplicate values
are allowed.

Is This Answer Correct ?    12 Yes 3 No

what is Hashmap & Hashtable wirh example?..

Answer / leosun

Hashtable will not allow null key nor values,where as
Hashmap allows null key and values

Is This Answer Correct ?    14 Yes 8 No

what is Hashmap & Hashtable wirh example?..

Answer / venki

1. Hashtable is synchronized which means Hashtable is thread
safe and that can be shared with multiple threads (Suitable
for multi threaded applications), HashMap not synchronized
(Suitable for single threaded applications).
2. Iterator in the Hashtable is fail-fast iterator and throw
ConcurrentModificationException if any other thread modifies
the map by adding or removing elements from the Map, while
Emnumeration in HashMap not.
3. Hashtable is slower than HashMap because of synchronization.
4. HashTable does not allow null for both keys and values,
you will get NullPointerException if you add null. whereas
HashMap allows one null key and any number of null values.
5. Hashtable and HashMap allows duplicate values.
6. Hashtable store objects in insertion order but HashMap
doesn’t store objects in insertion order, to store objects
in insertion order use LinkedHashMap.

Is This Answer Correct ?    0 Yes 1 No

what is Hashmap & Hashtable wirh example?..

Answer / sivadasan

Hashmap is not Synchronized where as Hashtable is
Synchronized.

Hashmap allows null values as keys.
Hashtable doesn't allows null values as keys.

Is This Answer Correct ?    3 Yes 6 No

Post New Answer

More Core Java Interview Questions

What do you mean by of string::valueof expression in java 8?

0 Answers  


What is the difference between I ++ and ++ I in java?

0 Answers  


Differences between jdk 1.4 and 1.5

6 Answers   SoftSol, TCS, Wipro,


What do you mean by aggregation?

1 Answers  


y cant i declare method like public final static show()

3 Answers  


Can we define constructor in inner class?

0 Answers  


The class "Class" is belongs to which package?? a) java.lang b)java.lang.reflect c)java.util d)None

4 Answers  


How we create object in copy constructor?

0 Answers   HCL,


What is the use of using enum to declare a constant?

0 Answers   Fidelity,


What state is a thread in when it is executing?

0 Answers  


What is meant by JVM ?

6 Answers  


What is the default size of load factor in hashing based collection?

0 Answers  


Categories