Question: In Java, variables of the super class class can point to objects of the subclass. For example, if Student is a super class to Athletes,

In Java, variables of the super class class can point to objects of the subclass. For example, if Student is a super class to Athletes, then any variable (say s) of type Student can point to either Student or Athlete objects. Sometimes we want to know exactly whether s is pointing to Student or pointing to Athlete. This can be accomplished with an if statement. Complete the missing part in the following if statement so it prints YES if the variable s is currently pointing to an Athlete if (s ____________ Athlete) System.out.print("YES"); Note: Your answer should be just the missing part for the ____________ section. Do not repeat the entire if statement in your answer. E.g. your answer should be AB CD if you want the if statement to be interpreted as if (s AB CD Athlete) System.out.print("YES");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!