Concept explainers
In an inheritance relationship, this is the general class.
- a. subclass
- b. superclass
- c. slave class
- d. child class
The general class in the inheritance relationship is “superclass”.
Hence, the correct answer is option “B”.
Explanation of Solution
Superclass:
- The superclass is the base class or a parent class which is used to derive a new class.
- The methods, functions and variables in the subclass are not used by the superclass.
- The keyword “extends” is used to define a subclass that extends a superclass.
- The superclass is the base class for all the classes, so in inheritance relationship, this is the “general” class.
Explanation for incorrect options:
a. subclass:
The subclass is the derived class from superclass, which means the subclass contains more information when compared with the superclass.
Hence, the option “A” is wrong.
c. Slave class:
There is no class called as “Slave” class in Java.
Hence, the option “C” is wrong.
d. Child class:
The derived class is sometimes called as child class in java.
Hence, the option “D” is wrong.
Want to see more full solutions like this?
Chapter 9 Solutions
Starting Out with Java: Early Objects (6th Edition)
Additional Engineering Textbook Solutions
Starting Out with Python (4th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with Python (3rd Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
- It is required to provide an explanation of the many different kinds of inheritance.arrow_forwardlanguage: Java Class Inheritance with an abstract class Define a class Employee with the following fields: _name, _empId, _department, _position (_title), _yearlySalary, _fullTime (a boolean: true/false) , _month , _year (time of hire) Add constructor and properties Define an abstract method GetBiMonthlySalary() (if the employee is paid twice a month) Define an abstract method GetVacationTime() that returns the number of vacation time this employee would have based on time of hire Override the ToString() method to return a string that contains the information pertaining to an employee such as name, empId, department, and where full time or not. Define a class HourlyEmployee that inherits from Employee. This class should have 2 fields of its own: _hours (hours worked in half a month) and _wage (hourly wage) Provide necessary constructor, properties and methods Override the ToString() to also return the additional fields Gets 3 days of vacation after first year if the…arrow_forwardThe mechanism of deriving a class from another derived class is known as A. Polymorphism B. Single Inheritance C. Multilevel Inheritance D. Message Passingarrow_forward
- Class Inheritance with abstract class Define a class Employee with the following fields: _name, _empId, _department, _position (_title), _yearlySalary, _fullTime (a boolean: true/false) , _month , _year (time of hire) Add constructor and properties Define an abstract method GetBiMonthlySalary() (if the employee is paid twice a month) Define an abstract method GetVacationTime() that returns the number of vacation time this employee would have based on time of hire Override the ToString() method to return a string that contains the information pertaining to an employee such as: name, empId, department, and where full time or not. Define a class HourlyEmployee that inherits from Employee. This class should have 2 fields of its own: _hours (hours worked in half a month) and _wage (hourly wage) Provide necessary constructor, properties and methods Override the ToString() to also return the additional fields Gets 3 days of vacation after first year if the employee works…arrow_forwardThe mechanism of deriving a class from another derived class is known as? A. Polymorphism B. Single Inheritance C. Multilevel Inheritance D. Message Passing Justify your answer with explanationsarrow_forwardObject-oriented programming allows you to derive new classes from existing classes. This is called... inheritance encapsulation abstraction generalizationarrow_forward
- Multiple inheritance can be explained as all choices are wrong one class inheriting from more super classes more classes inheriting from more super classes one class inheriting from more super classes and more classes inheriting from one super class more classes inheriting from one super classarrow_forwardJava - If the programmer doesn't declare any constructors for an extended class, what constructors will be inherited from the superclass? How does this inherited constructor initialize new instance variables that are not part of the superclass?arrow_forwardAssume different members and methods of a real world class is grouped or embedded into a single element. This is called in Object-Oriented Programming language Select one: a.Inheritance b.Polymorphism C.Encapsulation d.Abstractionarrow_forward
- HAS-A relationship between the classes is shown through. A - Inheritance B - Container classes C - Polymorphism D - None of the above.arrow_forwardInheritance makes it more difficult to design object class tests. Explain.arrow_forwardA subclass of an abstract class must be able to do all of the things the parent class can do. True or not?arrow_forward
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT