Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

difference between Hash Table, hash set and Hash Map?

  Asked By: Koila    Date: Jun 15    Category: Java    Views: 8080
  

In JDBC, we are writing the code directly using Class.forName("Driver details");
and
Driver Manager.getConnection("======");

without instatiating the DriverManager instance, Why? What is the use of
Class.forName("====="); ?

While serialising the objects, Which objects cannot be serialised apart from
transient variables?

I hope that you all have answer to my query...

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Whitney Cruz     Answered On: Jun 15

> Could you plase tell me the difference  between
hash  Table, hash set  and Hash Map?

HashMap is roughly equivalent to Hashtable, except
that it is unsynchronized and permits nulls. This
class makes no guarantees as to the order of the map;
in particular, it does not guarantee that the order
will remain constant over time.

HashSet implements the Set interface, backed by a hash
table (actually a HashMap instance). It makes no
guarantees as to the iteration order of the set; in
particular, it does not guarantee that the order will
remain constant over time. This class  permits the null
element. This class offers constant time performance
for the basic operations (add, remove, contains and
size), assuming the hash function disperses the
elements properly among the buckets

Hashtable implements a hashtable, which maps keys to
values. Any non-null object can be used as a key or as
a value.

> In JDBC, we are writing  the code  directly using
> Class.forName("Driver details"); and
> Driver Manager.getConnection("======");
without  instatiating the DriverManager instance,
> Why?

getConnection is a static method. You do not need an
instance of the class to use it.

> What is the use of Class.forName("====="); ?

Given a class's name as a string, it returns a
description of the class.

> While serialising the objects, Which objects  cannot
> be serialised apart from transient variables?

no idea, sorry.

 
Didn't find what you were looking for? Find more on difference between Hash Table, hash set and Hash Map? Or get search suggestion and latest updates.




Tagged: