008-001-010

Method Definition: With Parameter

Easy

Problem Description

method Definition: With Parameter

In this problem, you will create a program that defines a Printer class with two parameterized methods (printMessage and printNumber), where each method receives a String and an integer respectively and displays them to standard output.

Learning Objective: Understand definition and invocation of methods with parameters

Overview

Define methods that receive parameters and perform processing.

Specifications

  • Create a Printer class
  • printMessage(String msg) method outputs the argument message
  • printNumber(int num) method outputs the argument number
  • Call both methods in Main class

Output Format

Message: Hello
Number: 42

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