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

The “instanceof” operator:

  • The “instanceof” operator tests whether an object belongs to a particular type.
  • For example,

    //use of instance of operator

    obj instanceof Question

  • The above statement returns “true” if the type of “obj” is convertible to “Question”.
  • This happens if “obj” refers to an actual class “Question” or to a subclass such as “ChoiceQuestion”.

Class “Object”:

  • The “Object” is the root class of library of java.
  • By default, the class “Object” is the base class of all other java classes.
  • Every class is subclass of class “Object”.

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