Friday, July 11, 2008

Java Generics in the Inside

You may ask how Java handle the Generics objects???

1. Source compiles into a class file.
- The generic class (eg. AnyClass <T>) is stored in name AnyClass.class and the <T>information is stored with it.

2. The 'new' command creates a normal object.
- The object constructed has one of the type information

3. Code is generated to access the object.
- Type checking is made at compile time to make sure the correct object type are used.

No comments:

Post a Comment