Professional Documents
Culture Documents
Operators (COMP APP)
Operators (COMP APP)
Example:
&&
&
|| logical OR
| Inclusive OR
Truth Table
X1 X2 RESULT
Truth Table
X1 X2 RESULT
Example
Int i=0;
Int j=10;
Test=(i<10) || (j++>9);
System.out.println(i); =0
(j); =10
(test); TRUE
Test=(i<10) | (j++>9);
System.out.println(i); =0
(j); =10
(test); TRUE
^ exclusive OR
| LOGICAL NOT
X1 X2 RESULT
IF STATEMENTS
Syntax: if (test_expression)
Statement 1;
Statement 2:
Example:
If(b>a)
System.out.println(b is greater);
}
Flowchart
Start
T Exp F
Statement Stop
IF ELSE STATEMENTS
Syntax: if (text_expression)
Statement1;
Else
Statement2;
}
Flowchart
Start
T Exp F F
Stop
ELSE IF
Syntax:
If (test_expression)
Statement1;
Else if (tes_expression)
Statement2;
Else
Statement 3
}
Nested Ifs
Syntax:
Syntax:
If (test_expression_1)
If(nested_expression_1)
Satement 1
Else
Statement2;
1. Write a program to determine the flow regime of a fluid. Input is the Reynolds number no.
2. Create a java program that will determine the largest value. Print the largest value with
identifying message. Input two numbers only.
1.
2.