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
Write a code to create a trigger to call a stored procedure
What are recursive functions? Give some examples?
why java uses class level type casting ?
What is a platform?
When is the arraystoreexception thrown?
What does .equals do in java?
What is lazy initialization in java?
what is aggregation in java?
Can a class have 2 constructors?
You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain
What is native method in java?
Can singleton class be serialized?
What is the difference between final, finally and finalize()?
How to perform binary search in java?
Using callable statement how can you pass out parameters, explain with example?