File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Vector and null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Vector and null" Watch "Vector and null" New topic
Author

Vector and null

Sarma Lolla
Ranch Hand

Joined: Oct 21, 2002
Posts: 203
Which of the following types can be added to java.util.Vector?
A) reference
B) null
C) int
D) All of the above
The answer given in the mock are A, B.
When I verified I am able to add null to Vector.
Are there any other collection classes where I can add null?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
All the Collection classes can hold nulls. By the way, the JavaRanch newsletter has a multi-part article on Collections.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Sarma. Hashtable won't allow null for keys or values. While HashMap allows the null key and null values.


SCJP2. Please Indent your code using UBB Code
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Vector and null
 
Similar Threads
Strange ClassCastException working with JTable
Help! Class Cast Exception
Splitting an XML file
which object can be add into a Vector?
Using add on Vector<?>