009-002-010
The public Access Modifier
Easy
Problem Description
The public Access Modifier
In this problem, you will create a program that defines a public add method in a Calculator class, calls it from the Main class, and displays the calculation result to standard output.
Learning Objective: Understand the meaning and usage of the public access modifier
Overview
Define a public method and verify it can be accessed from anywhere.
Specifications
- Define public add(int a, int b) method in Calculator class
- Call add(10, 5) from Main class
- Output the result
Output Format
Result: 15
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