Java Concepts Chapter 13: Inheritance Questions
and Answers| Latest Update
how do abstract classes differ from interfaces ✔️✔️abstract classes can have instance fields and
they can have concrete methods and constructors
makes it so that no one can extend the class ✔️✔️declaring the class final (you can also declare
methods as final so that they can't be overridden)
four levels of controlling access to fields ✔️✔️public access, private access, protected access,
package access
the default access when no access modifier is given ✔️✔️package access
all methods of classes in the same package can access the feature ✔️✔️package access
can only be accessed by the methods of their own class ✔️✔️private features
can be accessed by methods of all classes ✔️✔️public features
protected features can be accessed by ✔️✔️all subclasses and all classes in the same package
define the toString method to ✔️✔️yield a string that describes the object state
If you want your toString method to be usable by a subclass ✔️✔️return getClass().getName() +
desired print info
and Answers| Latest Update
how do abstract classes differ from interfaces ✔️✔️abstract classes can have instance fields and
they can have concrete methods and constructors
makes it so that no one can extend the class ✔️✔️declaring the class final (you can also declare
methods as final so that they can't be overridden)
four levels of controlling access to fields ✔️✔️public access, private access, protected access,
package access
the default access when no access modifier is given ✔️✔️package access
all methods of classes in the same package can access the feature ✔️✔️package access
can only be accessed by the methods of their own class ✔️✔️private features
can be accessed by methods of all classes ✔️✔️public features
protected features can be accessed by ✔️✔️all subclasses and all classes in the same package
define the toString method to ✔️✔️yield a string that describes the object state
If you want your toString method to be usable by a subclass ✔️✔️return getClass().getName() +
desired print info