Java Reference
In-Depth Information
5.4.2 Predicate Methods
A predicate method is a method that returns a boolean value. Here is an example
of a predicate method:
A predicate method returns a boolean value.
public class BankAccount
{
public boolean isOverdrawn()
{
return balance > 0;
}
}
205
206
You can use the return value of the method as the condition of an if statement:
if (harrysChecking.isOverdrawn()) . . .
There are several useful static predicate methods in the Character class:
isDigit
isLetter
isUpperCase
isLowerCase
Search WWH ::




Custom Search