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 difference between the file and randomaccessfile classes?
What are data structures in java?
What is a package in java? List down various advantages of packages.
What is a class in java?
What is the final class?
What is an escape character in java?
when to use ArrayList and when to use HashMap in webApplication.
What is thread life cycle in java?
What do you know about the garbage collector?
What is difference overloading and overriding?
What is the advantage of OOP in java?
Implement 2 stacks with just 1 array. The stack routines must not indicate overflow unless every slot in array is used.
List some features of the abstract class.
Is string pool garbage collected?
What is module in project?