Which of the following can fill in the blank in this code to make it compile?
Correct Answer: C
From Java SE 8, we can use static and/or default methods in interfaces, but they should be non abstract methods. SO in this case using default in blank is completely legal. Hence option C is correct. Option A is incorrect as given method is not abstract, so can't use abstract there. Options B and E are incorrect as we can't have non abstract method interface if they are not default or static. https;//docs.oraclexom/javase/tutorial/java/Iandl/defaultmethods.html
Question 162
Given: And the code fragment: What is the result?
Correct Answer: C
Question 163
Given the class definitions: And the code fragment of the main() method, What is the result?
Correct Answer: D
Question 164
Given: What is the result?
Correct Answer: C
Question 165
Given the code fragment: What is the result?
Correct Answer: A
At line n1, Person class hasn't any constructor without arguments. At line n2, there isn't any method Person. If we want to call the constructor that should be "this(name)".