Which of the following statements are true?
a)Source A cannot be compiled
b)Source B will be compiled with warning(s).
c)No exception will be thrown during the runtime.
d)Source C will be compiled with warning(s). A ClassCastException exception will be thrown during the runtime

Answer:

Answer5 : a,b
a) The compiler does not know the type of the element stored in b5. That is why it cannot guarantee an apple can be inserted into the basket b5. So the statement s5.setElement(new Apple()) ist not allowed. The methode b5.setElement(..) cannot be used at all.
b) The compiler does not know the type of the element stored in b. That is why it cannot guarantee apples can be inserted into the basket b. But since we did not specify the type of the element of b at all, the compiler will accept the source code and compile it as if it was a pre 1.5 source code. Since the compiler cannot assure the type safety of the compiled code, it will issue a warning.