001-003-012

Method Parameter Scope

Medium

Problem Description

method Parameter Scope

In this problem, you will create a program that defines two methods greet(String name) and calculate(int value), verifies method parameter scope, and displays the results to standard output.

Learning Objective: Understand that method parameters are only valid within that method

Overview

Create multiple methods and verify parameter scope and shadowing concepts.

Specifications

  • greet(String name): outputs "Hello, " + name
  • calculate(int value): calculates and outputs value * 2
  • In main, call both methods

Output Format

Hello, Alice
Double of 5 is 10

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