0% found this document useful (0 votes)
8 views1 page

Sheet 3

The document provides examples of Boolean data types in programming, illustrating various comparisons and logical operations. It shows the results of different Boolean expressions, including true and false outcomes, as well as errors in syntax. The examples highlight the use of logical operators such as AND, OR, and NOT in determining Boolean values.

Uploaded by

Fortj Ngnbum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Sheet 3

The document provides examples of Boolean data types in programming, illustrating various comparisons and logical operations. It shows the results of different Boolean expressions, including true and false outcomes, as well as errors in syntax. The examples highlight the use of logical operators such as AND, OR, and NOT in determining Boolean values.

Uploaded by

Fortj Ngnbum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

The Boolean Type: )‫(البيانات المنطقية‬

boolean b = true; boolean b = false; boolean b = (1 F


> 2);
System.out.println(b); System.out.println(b); System.out.println(b);

True False False


boolean b = (1 < 2); boolean b = (1 >= 2); boolean b = (1 <= 2);
T
System.out.println(b); System.out.println(b); System.out.println(b);

True False True


boolean b = (1 == 1); boolean b = (1 = 1); boolean b = (1 != 2);
System.out.println(b); System.out.println(b); System.out.println(b);

True error True


int x = 10; int x = 10; boolean ba = true;
int y = 12; int y = 12; 10712 boolean bb = false;
boolean b = (x 12
10< y); System.out.println(x > boolean bc = ba && bb;
System.out.println(b); y); System.out.println(bc);

True False False


boolean ba = (7 == 7); boolean ba = true; boolean ba = true;
boolean bb = (1 > 2);
boolean bc = ba || bb; F boolean bb = false;
boolean bc = ba ^ bb; 00
boolean bb = (2 > 1);
boolean bc = ba ^ bb;
System.out.println(bc); System.out.println(bc); System.out.println(bc);

True True False


boolean ba = true; boolean b; boolean b;
T 2);
F || (2 == b = (1 / 2 0 of
O
boolean bb = !ba;
F
System.out.println(bb);
b = (1 > 2)
O
System.out.println(b);
> 0);
System.out.println(b);

False True False


boolean b; 0 int x = 10; int x = 10;
570
b = (1.0 / 2 > 0); T boolean b; int y = 9;
System.out.println(b); b = (0 > 2 * x); F
820 boolean b;907100 F
System.out.println(b); b = (x * y > 100);
System.out.println(b);

True False False


int x = 10; boolean ba = false; int x = 10;
boolean b; boolean bb = true; int y = 20;
407
b = !(x > 10);
IFy
System.out.println(b);
boolean bc = (ba > bb);
System.out.println(bc);
boolean b = (x && y);
System.out.println(b);

True error error

Prepared by Muhammad Alsharif Page 10

You might also like