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 the major difference between linkedlist and arraylist?

1035


Can we compare two strings in java?

1018


What are the different ways of creating thread?

1005


Does list maintain insertion order java?

905


What are the steps involved to create a bean?

1150


Define locale.

1036


Can we extend immutable class?

976


What is the difference between throw and throws keywords?

1047


What is e in java?

957


Why are parameters used in functions?

1011


What is a byte array?

1095


What is role of void keyword in declaring functions?

1046


why are wait(), notify() and notifyall() methods defined in the object class? : Java thread

984


What are runtime exceptions?

1155


What is the difference between actual and formal parameters?

941