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...

why HashTable not allow null key and value

Answer Posted / naveen

There is null check in the put method implementation of
hashtable, so it does not support null values and null keys.


public Object put(Object key, Object value) {
// Make sure the value is not null
if (value == null) throw new NullPointerException();
}

above is HashTable put method logic implemented by Sun.

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is anti pattern in programming?

1013


What are the restrictions imposed by a Security Manager on Applets?.

2650


What is java used for?

1061


Is java code slower than native code?

1121


what is meant by abstract class?

1183


What is the difference between hashset and treeset in java?

1109


What languages are pass by reference?

1109


How many ways can you break a singleton class in java?

1029


what is collatration?

3326


Are arrays primitive data types?

1255


What is finalize()? Is finalize() similar to a destructor?

1004


What do you know about the garbage collector?

1156


What is the difference between compare and compareto in java?

1105


Can we have any other return type than void for main method?

999


What is finally and finalize in java?

1158