answersLogoWhite

0

How can Boolean be used in Java?

Updated: 8/9/2023
User Avatar

Wiki User

10y ago

Best Answer

An expression is anything that can be evaluated ("calculated"), to get a value. Numeric expressions are more common: anything that you can calculate, and get a number. For example, if a and b are numbers, a + b will give you another number - it is therefore a numeric expression. The variables by themselves are also numeric expressions.

A boolean expression is anything that you can evaluate and get a result that is boolean, i.e., either true or false. Here are some examples:

a == b

a > b

a >= 5 && a <= 10 // && means "and"

Any method that returns either true or false, for example (for the String class) the method matches(), which states whether the string does, or does not, match a certain pattern.

An expression is anything that can be evaluated ("calculated"), to get a value. Numeric expressions are more common: anything that you can calculate, and get a number. For example, if a and b are numbers, a + b will give you another number - it is therefore a numeric expression. The variables by themselves are also numeric expressions.

A boolean expression is anything that you can evaluate and get a result that is boolean, i.e., either true or false. Here are some examples:

a == b

a > b

a >= 5 && a <= 10 // && means "and"

Any method that returns either true or false, for example (for the String class) the method matches(), which states whether the string does, or does not, match a certain pattern.

An expression is anything that can be evaluated ("calculated"), to get a value. Numeric expressions are more common: anything that you can calculate, and get a number. For example, if a and b are numbers, a + b will give you another number - it is therefore a numeric expression. The variables by themselves are also numeric expressions.

A boolean expression is anything that you can evaluate and get a result that is boolean, i.e., either true or false. Here are some examples:

a == b

a > b

a >= 5 && a <= 10 // && means "and"

Any method that returns either true or false, for example (for the String class) the method matches(), which states whether the string does, or does not, match a certain pattern.

An expression is anything that can be evaluated ("calculated"), to get a value. Numeric expressions are more common: anything that you can calculate, and get a number. For example, if a and b are numbers, a + b will give you another number - it is therefore a numeric expression. The variables by themselves are also numeric expressions.

A boolean expression is anything that you can evaluate and get a result that is boolean, i.e., either true or false. Here are some examples:

a == b

a > b

a >= 5 && a <= 10 // && means "and"

Any method that returns either true or false, for example (for the String class) the method matches(), which states whether the string does, or does not, match a certain pattern.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

Boolean is not a keyword in Java. boolean is.

The Boolean class wraps a value of the primitive type boolean in an object.

Boolean objects may be stored in a container data structure, converted from and to a String, and compared to other objects.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Boolean can be used in Java for two values, either true or false. Usually it used to determine whether or not something is true. Java for dummies will give you very detailed information about how to use it successfully.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

An expression is anything that can be evaluated ("calculated"), to get a value. Numeric expressions are more common: anything that you can calculate, and get a number. For example, if a and b are numbers, a + b will give you another number - it is therefore a numeric expression. The variables by themselves are also numeric expressions.

A boolean expression is anything that you can evaluate and get a result that is boolean, i.e., either true or false. Here are some examples:

a == b

a > b

a >= 5 && a <= 10 // && means "and"

Any method that returns either true or false, for example (for the String class) the method matches(), which states whether the string does, or does not, match a certain pattern.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

boolean means true or false ONLY.

not like in c++ where any non-zero value is true, and zero is false.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can Boolean be used in Java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you do a boolean test on integer in java?

No


What is default value of Boolean type variable?

False will be the default value of the boolean datatype in java


How do you represent or in java?

A boolean or comparison in Java is made with the operator.boolean a = true;boolean b = false;if( a b) {...}A bitwise or comparison in Java is made with the | operator.int n = 1;int m = 2;if( n | m == 3 ) {...}


What is the width of Boolean data type in java?

1 bit


Eight basic data types used in java?

char, boolean, byte, short, int, long, double, or float


What is the Java logical operators that has the highest order of preference?

"The following" doesn't make sense if you don't include a list. You can find a list of Java operators, including their precendence, at http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html. Or search for [java operator precedence] for additional places that explain this topic.


Where are a few of the places that one can learn more about Boolean values in Java?

There are a a few different websites that offer lessons on Boolean values in Java. The most reliable website is called HomeAndLearn because of its many different lessons.


How do you get boolean value from string in java?

Here is some sample code to convert a string into a boolean: String word = "true"; boolean boo; if (word.equalsIgnoreCase("true")) boo=true; else boo=false;


Difference between equals equals and equal in java?

"==" in java is the binary operator which compares two values and gives a boolean result While "=" in java is a assignment operator which assigns a value to a variable.


Why demorganization is used in boolean expression?

demorganization is used to reduce the Boolean expressions


What java operator reverses the truth or falsity of a condition?

The ! (boolean invert) operator returns the opposite of a boolean's current value: if(!(7 5," and the statement produces this output: not equal


List the eight basic data types used in java and give examples?

The 8 primitive data types are byte, short, int, long, float, double, boolean and char boolean is used to store logical values true/false char is used to store single digit characters. 'Y', 'X' etc the remaining data types are used to store a wide variety of numbers.