TYPES, VALUES AND VARIABLES(3)
TYPES, VALUES AND VARIABLES(3)
The boolean type represents a logical quantity with 2 possible values, the literal true and false.
Examples of boolean operators:
package api_package;
class Booleanexamples {
static Boolean first = false, second = false;
static boolean third = true;
public static void main(String[] args) {
// the equality operator on booleans
//both operands are type Boolean
System.out.print("Where both operands are Boolean: ");
System.out.println(first == second);
//one of type Boolean, unboxing conversion carried out
System.out.print("One Boolean unboxing gives result of ");
System.out.print(first == third);
}
}
No comments:
Post a Comment