Java Incompatible Types Boolean Int
Posted
by ikurtz
on Stack Overflow
See other posts from Stack Overflow
or by ikurtz
Published on 2010-05-24T15:25:38Z
Indexed on
2010/05/24
15:31 UTC
Read the original article
Hit count: 340
i have the following class:
public class NewGameContract {
public boolean HomeNewGame = false;
public boolean AwayNewGame = false;
public boolean GameContract(){
if (HomeNewGame && AwayNewGame){
return true;
} else {
return false;
}
}
}
when i try to use it like so:
if (networkConnection){
connect4GameModel.newGameContract.HomeNewGame = true;
boolean status = connect4GameModel.newGameContract.GameContract();
switch (status){
case true:
break;
case false:
break;
}
return;
}
i am getting the error: incompatible types found: boolean required: int on the following switch (status)
code.
what am i doing wrong please?
© Stack Overflow or respective owner