troubleshooting Question

Java - boolean

Avatar of zizi21
zizi21 asked on
Java
4 Comments2 Solutions383 ViewsLast Modified:
Hi ,

I came accross a code that read like this:
This is in the parent class.

public boolean drawmoney(double money)
if(balance>money)
return true;
else
return false;
}

Now in the int main, there is a check like this:
if(drawmoney(100)==false)
System.out.print("No money");

My question is, I find it strange that thereisn't any else statement to witdraw money.
For example,
if(drawmoney(100==false)
System.out.print("No money");
else
drawmoney(100);


Do i assume that when the first if statement is executed, it checks if true, it automatically withdrawsmoney, and only if false, it print...

Pls clarify. Thanks

ASKER CERTIFIED SOLUTION
Mick Barry
Java Developer
Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros