This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ""if" statment question  " Watch ""if" statment question  " New topic

"if" statment question

G. Graz
Ranch Hand

Joined: Oct 23, 2006
Posts: 30
Is it possible to pass Boolean method as a parameter of another Boolean methods “if” statement ?. Basically I want to have a “if” statement execute if the parameter ( in this case the other Boolean method) is true. Something to this effect :
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1789

Pretty sure you can.

When you do things right, people won't be sure you've done anything at all.
John de Michele

Joined: Mar 09, 2009
Posts: 600
Yes you can. That's a common and acceptable idiom.

G. Graz
Ranch Hand

Joined: Oct 23, 2006
Posts: 30
OK, great ! Thank you so much !
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46424
You mean to use the return value of a boolean method as an expression. You don't call it a parameter there.

Note this alternative version of your code
I agree. Here's the link:
subject: "if" statment question
It's not a secret anymore!