Results 1 to 3 of 3
Thread: Generics Differences?
- 02-21-2011, 06:18 AM #1
Member
- Join Date
- Aug 2009
- Posts
- 26
- Rep Power
- 0
Generics Differences?
Hey I was just wondering what's the difference between these two generics statements?
Java Code:Vector<String> v = new Vector<String>(); Vector<String> v2 = new Vector();
What I'm not 100% clear on is in what situation would you have generics on the right side of the equals operator. Could someone please give me an example of where such a thing may be used.
Cheers,
newbie
- 02-21-2011, 07:47 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,604
- Blog Entries
- 7
- Rep Power
- 17
Ignore the previous poster please; it's just a kid, raving mad and his posts will hopefully removed soon.
The second initialization only exists for backwards compatibility reasons; it creates a raw type and assigns it to a generic type. Alsways try to use the first form if you want to play it by the rules.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 02-21-2011, 11:11 AM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,604
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
Boosting differences
By belsen in forum LuceneReplies: 0Last Post: 11-24-2010, 09:26 AM -
J2EE and J2ME differences
By ianbram in forum Advanced JavaReplies: 3Last Post: 11-27-2008, 09:19 AM -
Differences between constructor and method
By Java Tip in forum Java TipReplies: 0Last Post: 12-19-2007, 08:53 AM -
differences: AWT and Swing
By baltimore in forum AWT / SwingReplies: 1Last Post: 08-06-2007, 09:01 AM -
differences between 2 dates
By cecily in forum New To JavaReplies: 1Last Post: 08-02-2007, 05:37 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks