October 2017
Beginner
318 pages
7h 26m
English
The protected method is the protected protection setting. If we declare that member variables are protected, it implies they're private and not accessible by anyone, except the class and it's subclasses:
package inheritance;public class Literature { protected String title; protected String author;
Just to reassure ourselves, everything we've been doing here is legitimate. Let's run our program again and make sure the output looks good, which is the case. After this, we should have a pretty good grasp of inheritance. We can develop a lot of systems that really mimic their real-world counterparts, and we can write very elegant and functional code using inheritance and small classes that don't do a lot of complicated things ...
Read now
Unlock full access