This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes valid declarations 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 » Java » Beginning Java
Bookmark "valid declarations" Watch "valid declarations" New topic
Author

valid declarations

Giancarlo Yataco
Greenhorn

Joined: Feb 01, 2009
Posts: 2
Hi Guys.
Lately I've been reading all about declarations in java and trying to resolve exercises about it.
I've been trying to figure out the answer of the following question but i still don't understand. The book says A , B and D are the answers. But why not C? and why D??

1.Which of the following are valid declarations? Assume java.util.* is imported.

A.Vector<Map> v;

B.Set<String> s;

C.Map<String> m;

D.Map<String, String> m;

Thanks in advance.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

Welcome to Javaranch.
Since Map is an object that maps keys to values , The general declration of Map is Map<K,V> (keys, Values) Thats the reason D is true

Refer this
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
Welcome to JavaRanch

Please always when you post that sort of question, say where it comes from.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: valid declarations
 
Similar Threads
array.length
BigDecimal Contsructer Pitfall.
could anybody help me to find out the answers for these questions
ejbCreate()??
valid declarations of main()