A cast is required in which of the following situations?
a) using charAt to take an element of a String and store it in a char
b) storing an int in a double
c) storing a double in a double
d) storing a double in an int
e) all of the above require casts
Answer: d. Explanation: For a, charAt returns a char, so there is no problem. In b, the situation is a widening operation taking a narrower type and storing the value in a wider type. Only in d is there a situation where a wider type is being stored in a narrower type, so a cast is required.