EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 10, Problem 1RQ
Program Plan Intro

To find the correct option that can be used as a reliable way to find which class is a base class and which is a derived class.

Expert Solution & Answer
Check Mark
Program Description Answer

b. try saying the two class names together.

Explanation of Solution

Explanation:

Classes can be derived from other classes in Java, as in other object-oriented programming languages. A subclass is called to be the derived class. The superclass is the class from which it is derived. The extended keyword in Java can be used to declare a class as a subclass of another class. Subclasses inherit variables and methods from their superclasses and can utilize them as if they were specified within the subclass.

A reliable way that will help to find which of the two classes is the base class and which is a subclass is by try saying the two class names together.

By saying the names of both base class and derived class, one should check which class is containing more generalized features and which is not. A class that contains more generalized features should be considered as the base class and the other one should be considered as the derived one.

For example: Consider two classes Birds and Pigeon. If we call the names of both, surely, the Birds class will contain more generalized features instead of the Pigeon class. So, the Birds class will be a base class and the Pigeon class will be the derived one.

Conclusion:

Therefore, the correct option is option b. try saying the two class names together.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Implement the following using JAVA: a.Design a class named Person and its two subclasses named Student andEmployee. b.Make Faculty and Staff subclasses of Employee. Please note that,● A person has a name, address, phone number, and email address. A student has aclass status (freshman,sophomore, junior, or senior). You can define the status as aconstant.● An employee has office & salary.● A faculty member has office hours and a rank.● A staff member has a title. c. Draw a UML diagram of the system.
Answer both to get a like or don't attempt.Thanks Question: 3. _________is a correct annotation with respect to JUnits.4. Is it necessary to write the test class to test every class? __________
Use C++ Create a class called Fruit. Add one member variables name. Add only one getter function for the name. The get function returns name. Implement a constructor that expects name value and assigns it to the member variable. This class doesn't have an empty constructor. Create a subclass of Fruit named CitrusFruit. The CitrusFruit class has two member variables weight and color.  Add a constructor which expects weight and  name and color.Pass name to the base constructor and set weight and color to it's member variable. Write a program that has an array of  3 Fruits, and an array of 3 CitrusFruits. Feel free to give the name , weight and color to the object as your choice. Use loops to print out the array properties to the terminal screen.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY