mardi 22 avril 2014

Return random boolean and use to guide an "if" statement


Vote count:

0




I've been researching how to return a random boolean and then use that returned boolean to drive an "if" statement, but I can't figure out how to structure or what syntax to use.



private Random random;

public void mousePressed(MouseEvent e) {
determineHit();
if (random = true) {
//Perform true//
}
else {
//Perform false//
}

private boolean determineHit() {
return random.nextBoolean();
}


How can I get my determineHit method to return the boolean and then plug that back into the main body of the method?


Thanks



asked 14 secs ago






Aucun commentaire:

Enregistrer un commentaire