012-002-006

static Modifier: Using Class Methods

Medium

Problem Description

static Modifier: Using class Methods

In this problem, you will create a program that implements a static method max(int, int) in a MathUtil class, calls it directly using the class name without creating an instance, and displays the maximum of two integers to standard output.

Learning Objective: Understand characteristics of static methods and implement utility methods callable without instances

Overview

Create a MathUtil class and implement a static method that returns the maximum of two integers. Call the method directly from the class name without creating an instance.

Specifications

  • MathUtil class static method max(int, int): Returns larger of two integers
  • In main method, call MathUtil.max() and output result
  • No instance creation required

Output Format

Max value: 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?