What is the use of protected keyword in Java?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Works at Tesla, Lives in San Francisco. Graduated from University of California, Berkeley with a degree in Mechanical Engineering.
The protected keyword is an access modifier for method and variable of a class. When a method or a variable is marked as protected, it can be accessed from: Within the enclosing class. Other classes in the same package as the enclosing class.
2023-05-10 12:30:26
评论(499)
Helpful(122)
Helpful
Helpful(2)

Benjamin Davis
QuesHub.com delivers expert answers and knowledge to you.
The protected keyword is an access modifier for method and variable of a class. When a method or a variable is marked as protected, it can be accessed from: Within the enclosing class. Other classes in the same package as the enclosing class.