Thursday, February 7, 2008

Part 4 of 4 : Practice Questions for Generics in JAVA

Question No: 1

What will be the output of this program?



Question No : 2

Will this code compile?


Question No: 3
3) Generics are implemented by Type Erasure ??

True or False?


Question No: 4
4) It is legal to create an ArrayList without a type (i.e. without the < ... > ) statement.

True or false?


Question No: 5
5)What happens when you try to compile and run the following program??



Question No: 6

6)
What happens when you try to compile and run the following program??



Question No: 7
7)While writing the generic classes in Java, which of the following can be used as Generic Parameters? (Can be more than one)

a) Classes
b) Primitive Types
c) Compile time Constants.



Question No: 8

What happens when you try to compile the following code?




Question No: 9


Question No:10 
Given the following: What will be the output of the program?


Question No: 11
Given the following, What is true here? 
1) This code will compile without warning and give output equal to 89.
2) This code will compile with warning and give output equal to 89. 
3) This code will not compile. 
4) Run time exception. 

Question No: 12 
Is the following code legal?
For Answers, Please look at this page >>ANSWERS<<