I'm in my first year of Java and am having trouble with with a boolean method to test if even or odd. I have most of the code, but when I enter an odd number it returns it as even. My professor gave us the signature of the method: public static boolean isOdd(int number)
package homeWork1;
import java.util.Scanner;
public class OddTest {
public static void main(String args[])
{
int number;
System.out.println("Enter an integer to check if it is odd or even: ");
Scanner input = new Scanner(System.in);
number = input.nextInt();
isOdd(number);
boolean answer=isOdd(number);
if (answer=true)
{
System.out.println("EVEN");
}
if (answer=false)
{
System.out.println("ODD");
}
}
public static boolean isOdd(int number)
{
if(number % 2 == 0)
{
return true;
}
return false;
}