+ 1
What is boolean and how can it be used
4 ответов
+ 4
All about boolean:
https://en.m.wikipedia.org/wiki/Boolean
+ 3
It is the result of an expression that evaluates to true (1) or false (0). It is also true, pun intended, that if you search here in Discuss for boolean you will find the answer to the question you asked.
+ 2
Hi Loo Student
A Google search would’ve give you the same answer.
Booleans store two possible values. Usually either true or false. An example for the usage of a boolean would be..
/* asking if someone is permitted to do something… */
boolean permissions = true;
if ( permissions == true) {
System.out.println("User is permitted!");
}
else {
System.out.println("User doesn’t have the necessary permissions!");
}
0
It is used mostly to execute code where particular conditions are met by the input or parameters passed to a function. For example, if you pass a phone number instead of an email address in a web form, the validity checker returns false and the code to submit your input is not executed.