Suppose a class has public visibility. In this class we define a protected method. Which of the following statements is correct?

Question:
Suppose a class has public visibility. In this class we define a protected method. Which of the following statements is correct?

1.From within protected methods you do not have access to public methods.

2.This method is only accessible from inside the class itself and from inside all subclasses.

3.In a class, you cannot declare methods with a lower visibility than the visibility of the class in which it is defined.

4.This method is accessible from within the class itself and from within all classes defined in the same package as the class itself.

Posted Date:-2021-10-25 05:16:02


More MCQS Questions and answers

Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!