Computer Science, asked by anishapattanaik883, 1 year ago

Suppose a class has public visibility. In this class we define a protected method. Which of the following statements is correct?
A.This method is only accessible from inside the class itself and from inside all subclasses.
B.In a class, you cannot declare methods with a lower visibility than the visibility of the class in which it is defined.
C.From within protected methods you do not have access to public methods.
D.This method is accessible from within the class itself and from within all classes defined in the same package as the class itself.

Answers

Answered by Anonymous
2
______✨ HEY MATE ✨______

➡️Option (D) is the right answer ✔️

<marquee>✌️ I THINK IT HELPED YOU ✌️
Answered by mindfulmaisel
1

option D is the correct answer

Explanation:

  • According to the question, option (D) is the proper answer.
  • The class is granted public visibility in the question, and we supply the protected method where,
  • This type of technique is normally accessible from within all classes stated, as well as from within the same class in the same directory as the class.
  • hence, according to the given question, option (D) is the correct response
Similar questions