MCQ Practice Single Best Answer Topic: Elements of Accounting

Q The use of protected keyword to a member in a class will restrict its visibility as follows:

Question ID
#24251
Subchapter
Elements of Accounting
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A visible only in the class and its subclass in the same package
  • B visible only inside the same package
  • C visible in all classes in the same package and subclasses in other packages
  • D visible only in the class where it is declared
Correct Answer: C

Explanation

The use of protected keyword to a member in a class will restrict its visibility as follows:

  • protected → Accessible in:

    • same package (all classes inside it) ✅

    • subclasses even in other packages

So the correct answer is:
(c) visible in all classes in the same package and subclasses in other packages

Share This Question

Share this MCQ with your friends or study group.