开发者

Does Java 1.4 have generics?

L开发者_运维技巧ooking at some old code in Java 1.4 but I'm unfamiliar with Java.

Does Java 1.4 have generics? I've been looking through the code and haven't found any uses of generics, but that doesn't necessarily mean they aren't supported.


No, that was a 1.5 introduction. (That is, "Java 2 release 1.5". There was the really old version 1.4 that was the farthest the Microsoft JVM got.)


No. Generics have been introduced with J2SE 5.0 (aka "Java 1.5", aka "Tiger").

Wikipedia has details on all changes.


No, Java 1.4 does not have Generics. As already indicated by others, it got introduced in 1.5. However, you can have a mixture of generic and non generic code for backward compatibility. This is possible because generic (or type safety) is a compile time event for JVM. On runtime the "eraser" removes all the type safety information and the type safe code becomes the plane old non type safe one.


Nope, didn't come along until Java 5.

However, the apache commons library has some useful stuff such as the TypedCollection decoration which can help you if your stuck on an old version of Java.

http://commons.apache.org/collections/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜