1z0-819 Exam QuestionsBrowse all questions from this exam

1z0-819 Exam - Question 80


Given:

and

and

What is the result?

Show Answer
Correct Answer: B

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'.

Discussion

10 comments
Sign in to comment
ObaltOption: B
Feb 7, 2023

Correct answer is B

StavokOption: E
Jun 7, 2023

E is correct The default method action() inherited from AbilityA conflicts with another method inherited from AbilityB

d7bb0b2
Jan 11, 2024

THAT IS NOT CORRECT, class implement two interfaces overriding the method, so this method is called

KiKittyKiOption: B
Jun 17, 2023

Correct Ans is B.. Tested

tmuralimanoharOption: B
Jun 29, 2023

Answer: B

eldonivanOption: B
Aug 18, 2023

The c.action(); in the main method calls Test.action() which in the implementation made by the Test class. Answer is: B ab action

[Removed]Option: B
Aug 30, 2023

COmpiles fine. Answer is B

OmnisumemOption: B
Sep 11, 2023

Tested: B.

d7bb0b2Option: B
Jan 8, 2024

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

mendjijetOption: B
Feb 8, 2024

B is correct TESTED

ASPushkinOption: B
Jul 8, 2024

answer : B even if it would be AbilityA x = new Test(); the same answer : "ab action"