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
What will be the default values of all the elements of an array defined as an instance variable?
What does java stand for?
What does the ‘static’ keyword mean? Is it possible to override private or static method in java?
Why packages are used?
What is an eror in java?
why Java does not support multiple inheritances?
What is the diffrence between inner class and nested class?
Convert a BST into a DLL and DLL to BST in place.
explain autoboxing in java?
Where are global variables stored?
Can we split string with in java?
Can we declare main () method as non static?
Is double bigger than float?
What is application tier?
What is indexof in java?