forum

home / developersection / forums / cannot convert from int to boolean using java

Cannot convert from int to Boolean using java

Kate Smith 4423 14-Oct-2013
public static void main(String[] args) 


{
    int [] newArray= new int [4];
    int [] array = {4,5,6,7};
    oddEven(array);

    newArray[0] = array[0]+array[1]+array[2]+array[3];
    newArray[1] = array[0]*array[1]*array[2]*array[3];

}

public static void oddEven(int [] oddEven)
{

    for (int i=0; i<oddEven.length; i++)
    {
        if (oddEven[i] % 2) // Cannot convert from int to boolean
    }
}

Ignore what I'm trying to manage here. I'm only curious why it doesn't accept "if" statement in this for loop.  As I stated it says "cannot convert from int to boolean". Why do you think it says so?


Updated on 14-Oct-2013
Kate Smith

Other


Message
Can you answer this question?

Answer

1 Answers

Liked By