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 the syntax and characteristics of a lambda expression?
What happens when a thrown exception is not handled?
How many bytes is double?
How can you set the applet size?
Can a static block throw exception?
how can i use a nonsynchronized hashtable?
What are facelets templates?
what is aggregation in java?
What classes of exceptions may be caught by a catch clause in java programming?
What initialize variables?
Explain the difference between string, stringbuffer and stringbuilder in java?
What is the meaning of 3 dots in java?
What are controls and their different types in awt?
Explain about member inner classes?
Explain notifyall() method of object class ?