Title Using instanceof for Converting Between Animal Types
Catalog Type SLCItem
Persistent ID https://codecheck.io/files/horstmann/codecheck-bj-4-inter-110
Platform Name CodeCheck
Features Code Completion
Description The Cat and Dog class below implement the Animal interface. All animals have names, but only dogs do tricks. Implement the describe method, using the instanceof operator to test whether the given animal is a dog. If so, return the name, a space, and the trick that the dog can do, such as "Helmut barks at the moon". If it is any other kind of animal, return the name, a space, and "has no tricks".
Keywords Interfaces
Author Cay Horstmann
Institution San José State University
Iframe URL https://codecheck.io/files/horstmann/codecheck-bj-4-inter-110
Protocol SPLICE, LTI 1.1
Protocol URL
License https://creativecommons.org/licenses/by-nc-nd/4.0/
Programming Language Java
Natural Language en

Preview

SPLICE Output