Oracle Certified Associate Java Se 8 Programmer · Free Practice Question Medium

Question 31

Consider the following code:

Which of the following Lines causes compile time error ?

  • A

    Line-3

  • B

    Line-4

  • C

    Line-5

  • D

    Line-1

  • E

    Line-2

  • F

    Line-6

Reveal correct answers

Correct answers: B, F

Explanation

Every method present in interface is by default public. Hence at the time of overriding/implementing that method, compulsory we should declare that method as public. We didn't declare method as public at Line-4 and Line-6. Hence we will get compile time errors.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need