In HashTable I am storing null value..then what is the
error it will show

Answers were Sorted based on User's Feedback



In HashTable I am storing null value..then what is the error it will show..

Answer / mvteja

Hashtable does not contain null value. if v try to store
null value, v will get the following error.




F:\Test>javac -d . Test.java

F:\Test>java a.b.c.Test
Exception in thread "main" java.lang.NullPointerException
at java.util.Hashtable.put(Unknown Source)
at a.b.c.Test.<init>(Test.java:18)
at a.b.c.Test.main(Test.java:27)

F:\Test>

Is This Answer Correct ?    16 Yes 0 No

In HashTable I am storing null value..then what is the error it will show..

Answer / karthik

Normally hastable doen't allow null value, it will through
run time exception like NullPointerException

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Advanced Java Interview Questions

How is serialization used generally ?

3 Answers  


What do you know about seam?

0 Answers  


Connection Pooling with different type of databases?

1 Answers  


What is checkpoint? How to create checkpoints in our java projects?

1 Answers   ABC,


What modifiers may be used with an inner class that is a member of an outer class?

0 Answers  


What are the ways to define classes that can be run as threads?

1 Answers   KPIT,


Name three component subclasses that support painting?

0 Answers  


Write a java program to find out the sum of harmonic series : 1 + ½ + 1/3 + ……… up to nth term , for any value of n.

2 Answers  


which book is better for jdbc ,servlets and jsp

0 Answers   TCS,


Differences between applications and applets?

3 Answers  


How can a dead thread be restarted?

1 Answers   IBM, Wipro,


What is a task?s priority?

1 Answers  


Categories