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 is anti pattern in programming?
What are the restrictions imposed by a Security Manager on Applets?.
What is java used for?
Is java code slower than native code?
what is meant by abstract class?
What is the difference between hashset and treeset in java?
What languages are pass by reference?
How many ways can you break a singleton class in java?
what is collatration?
Are arrays primitive data types?
What is finalize()? Is finalize() similar to a destructor?
What do you know about the garbage collector?
What is the difference between compare and compareto in java?
Can we have any other return type than void for main method?
What is finally and finalize in java?