Given:
and
and
What is the result?
Given:
and
and
What is the result?
The result will be 'ab action'. The class Test implements both AbilityA and AbilityB. Despite the default method in AbilityA, the Test class provides its own implementation of the action() method. When the main method creates an instance of Test and calls the action() method through an AbilityB reference, the action() method in the Test class is executed, outputting 'ab action'.
Correct answer is B
answer : B even if it would be AbilityA x = new Test(); the same answer : "ab action"
B is correct TESTED
B is correct=> so reference AbilityB ab = new Test(); is pointed to Test and test has method override this is called. In java real objetct (not reference OR TYPE AbilityB ) is pointed to method that is override by subclass
Tested: B.
COmpiles fine. Answer is B
The c.action(); in the main method calls Test.action() which in the implementation made by the Test class. Answer is: B ab action
Answer: B
Correct Ans is B.. Tested
E is correct The default method action() inherited from AbilityA conflicts with another method inherited from AbilityB
THAT IS NOT CORRECT, class implement two interfaces overriding the method, so this method is called