Java Interview Question And Answer If a method is declared as protected, where may the method be acc

preview_player
Показать описание
"If a method is declared as protected, where may the method be accessed ?"
* Answer :
* A protected method may only be accessed by classes or interfaces of the same package or
* by subclasses of the class in which it is declared.

A Job Portal

Other Top Job Portals

Are you looking for a new Job ?
Рекомендации по теме
Комментарии
Автор

It's not well explained. The point is that a child class defined in a different package from the parent can access the protected attribute. That's what sets it apart from the package access.

mcalavera
join shbcf.ru