Search⌘ K

Challenge 1: Method to Check Sum

Explore how to create a Java static method named checkSum that adds two integer inputs and returns 0, 1, or 2 based on whether their sum is less than, greater than, or equal to 100. This lesson helps you practice defining methods, using parameters, and applying conditional logic, enhancing your understanding of core Java method concepts.

We'll cover the following...

Problem statement

Write a static method checkSum that adds two integer arguments and returns 0, 1 or 2.

  • Takes two integers one and two in its input. Arguments are pass by value to the method.

  • Has a check variable whose value gets updated as ...