자격증/OCJP_ExamC
QUESTION 44
IT grow.
2018. 7. 26. 06:26
반응형
QUESTION 44Given:interface Fish { }class Perch implements Fish { }class Walleye extends Perch { }class Bluegill { }public class Fisherman {public static void main(String[] args) {Fish f = new Walleye();Walleye w = new Walleye();Bluegill b = new Bluegill();if (f instanceof Perch)System.out.print("f-p ");if (w instanceof Fish)System.out.print("w-f ");if (b instanceof Fish)System.out.print("b-f ");}}What is the result?A. w-fB. f-p w-fC. w-f b-fD. f-p w-f b-fE. Compilation fails.F. An exception is thrown at runtime.Solution : B
반응형