Fixing the 'findEvenOrOdd' method logic

Report a typo

In a Java program, you are developing a method used to determine whether a given number is even or odd. Currently, the program isn't working as intended. Your task is to fill the blanks in code to correctly declare the main method, state return type for the findEvenOrOdd method and ensure appropriate value is returned based on the if-else branching logic.

Fill in the gaps with the relevant elements
public class Main {
    public  void (String[] args) {
        String result = findEvenOrOdd(5);
        System.out.println(result);
    }
    static String findEvenOrOdd(int num) {
        if (num % 2 == 0) {
             "Even";
        } else {
            return "Odd";
        }
    }
}
staticmainreturn
___

Create a free account to access the full topic