008-001-009

Method Definition: No Parameters

Easy

Problem Description

method Definition: No Parameters

In this problem, you will create a program that defines no-parameter methods (sayHello() and sayGoodbye()) in a Greeter class, calls them in order from Main class, and displays the result to standard output.

Learning Objective: Understand definition and invocation of methods without parameters

Overview

Create a program that defines and calls methods without parameters.

Specifications

  • Create a Greeter class
  • sayHello() method outputs "Hello, World!"
  • sayGoodbye() method outputs "Goodbye!"
  • Call both methods in Main class

Output Format

Hello, World!
Goodbye!

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