Big Java Late Objects
Big Java Late Objects
2nd Edition
ISBN: 9781119330455
Author: Horstmann
Publisher: WILEY
Question
Book Icon
Chapter 9.3, Problem 15SC
Program Plan Intro

Method Overriding:

  • Overriding is a feature that allows a child class or subclass to specifically implement a method that already provided by one of its parent classes or super classes.
  • If the method of the subclass has name, parameters and return type as same as the method in the super class, then the method in the subclass is said to override the method in the super-class.

“super” keyword:

  • The keyword “this” is a reference variable that used to refer to the parent class objects.
  • The “super” keyword is used in the following contexts:
    • Use of keyword “super” with variables:
      • This situation comes when the base class and derived class has the same data members.
      • In this situation, ambiguity occurs for the Java Virtual Machine.
      • For avoiding ambiguity, the keyword “super” is used as reference to the variables of super class.
    • Use of keyword “super” with methods:
      • The keyword “super” is used to call methods of base class.
      • When the base class and derived class has same methods, the keyword “super” is used to refer to the methods of base class. Through this ambiguity is resolved.
    • Use of keyword “super” with constructors:
      • The keyword “super” can be used to access the constructors of base class.

Blurred answer

Chapter 9 Solutions

Big Java Late Objects

Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education