007-003-010
Pet Greeting Program
Easy
Problem Description
Pet Greeting Program
In this problem, you will create a program that defines a Cat class, instantiates it, and calls the greet() method to display Meow! to standard output.
Learning Objective: Understand the basics of class instantiation and method invocation
Overview
Create a Cat class and a program where the cat greets. Learn how to create objects from classes and call methods.
Specifications
- Define a
greet()method in theCatclass - The
greet()method outputsMeow! - In the
Mainclass, create a Cat instance and callgreet()
Output Format
Meow!
Hints
- Create an instance with
new Cat() - Call the method with
.greet()
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