Write a Java method that takes as input two integers and returns a boolean. Your method returns true if the first is equal to the second and false otherwise. Show how your method could be called with some example data. You do not need to write out an entire program, just the method and a line or two showing how this method could be called.

Respuesta :

Answer:

// testNumber method is declared

// with a Boolean return type

// It take 2 arguments

public static boolean testNumber(int number1, number2){

return number1 == number2;

}

testNumber(4, 10);

testNumber(17, 17);

Explanation:

testNumber(4, 10) will return false.

testNumber(17, 17) will return true.

The method is written in Java and well commented.

The method takes two arguments; number1 and number2. Then it return the result of the Boolean expression; number1 == number2

ACCESS MORE
EDU ACCESS
Universidad de Mexico