015-005-003

instanceof Operator: Type Checking

Medium

Problem Description

In this problem, you will create a program that instantiates an animal object (Dog, Cat, or Bird) based on the input string, uses the instanceof operator to determine its type, and displays the type name and flying capability to standard output.

instanceof operator: Type Checking

Learning Objective: Check object type using instanceof operator

Check animal object type with instanceof and perform type-specific processing.

Input

1 line: Animal type (dog, cat, bird)

Output

Type: [type name]
Can fly: [Yes/No]

Example

Input:

bird

Output:

Type: Bird
Can fly: Yes

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up