O
odie4penname
Hello everyone,
I'd like to make sure I have done this correct. I am using BluJ:
Create a public boolean method named
MynumberisOdd that takes an integer parameter named
num and returns a boolean value indicating whether num is Odd.
The method should check if num is odd and return true when the number is odd and false when the number is even
Here is what I have:
public class example
{
public static void main(String [] args)
{
int x=1;
}
public boolean isNumberOdd (int num)
{
return num%2 !=0;
}
}
I'd like to make sure I have done this correct. I am using BluJ:
Create a public boolean method named
MynumberisOdd that takes an integer parameter named
num and returns a boolean value indicating whether num is Odd.
The method should check if num is odd and return true when the number is odd and false when the number is even
Here is what I have:
public class example
{
public static void main(String [] args)
{
int x=1;
}
public boolean isNumberOdd (int num)
{
return num%2 !=0;
}
}