21.1 | Are there any compilation errors in (a) and (b)? |
| |
21.2 | What is wrong in (a)? Is the code in (b) correct? |
21.3 | What are the benefits of using generic types? |
21.4 | Can you create an instance using a generic type, for example, new E() or new E[20] ? |
21.5 | Since you create an instance of ArrayList of strings using new ArrayList<String>() , should the constructor in the ArrayList class be declared as public ArrayList<E>() |
21.6 | Can a generic class have multiple generic parameters? |
21.7 | How do you declare a generic type in a class? How do you declare a generic type in a method? |
21.8 | What is a bounded generic type? |
21.9 | What is a raw type? Is GenericStack the same as GenericStack<Object> ? |
21.10 | What are an unbounded wildcard, a bounded wildcard, and a lower bounded wildcard? |
21.11 | If your program uses ArrayList<String> and ArrayList<Date> , does the JVM load both of them? |
21.12 | Can a method that uses a generic class parameter be static? Why? |