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

What is the purpose of the finally clause of a try-catch-finally statement?

1 Answers  


Why use POJO when I can use hashmap

1 Answers   Infotech,


How do u supress the parameters from the displaying in the url?

2 Answers  


Write a singleton program?

1 Answers  


Can I run seam with jdk 1.4 and earlier?

1 Answers  


What is the priority of Garbage collector thread?

3 Answers  


What is aop(assepct oriented programing)?

1 Answers  


What is source and listener?

1 Answers  


What is scalable, portability in the view of J2EE?

1 Answers  


Difference between sleep and suspend?

3 Answers  


What is Remote Server?

1 Answers   TCS,


Why a component architecture for the java platform?

1 Answers  


Categories