Type checking and name resolution
- Construct a Java program that creates a generic
List<String> but which manages to fill this list with Integer
values. At what kind of instruction will such "misbehaving" code
usually fail at runtime?
- Which type is a subtype of each reference type? Why is
- Write an actually useful Java program that is
unfortunately rejected by Java's type checker. What changes do you have
to perform in order to make the program compile?
- Construct a (legal?) Java program that crashes SUN's Java
compiler during name resolution. (Not
a typical exam question!)