First page Back Continue Last page Overview Graphics
Generics and Reflection
Class Class has been generified
- Class literal Foo.class is of type Class<Foo>
Enables compile-time type-safe reflection
- Foo foo = Foo.class.newInstance();
Enables strongly typed static factories
<T extends Person> getPerson(Class<T> personType);
Child c = MyFac.class.getPerson(Child.class);