Lecture 03
Lecture 03
Fundamentals
Fall 2022
Lecture 3
Dr. Farhan Aadil
[email protected]
DrAadil.com
• Examples:
3 + 5 // uses + operator
The Operator Groups
– Arithmetic operators
– Assignment operator
– Increment/Decrement operators
– Relational operators
– Conditional operators
Arithmetic Operators
count = count + 1;
can be written as:
++count; or count ++;
count = count - 1;
can be written as:
--count; or count--;
System.out.println(ans);
System.out.print("The value of b is "+b);
}
}
2
The value of b is 2
Relational (Comparison) Operators
int x = 3;
int y = 5;
boolean result;
3) result = (x != x*y);
now result is assigned the value true because the product of x and y (15) is not equal
to x (3)
Conditional Operators
Symbol Name
&& AND
|| OR
! NOT
x y x && y x || y !x
}
Assignment
• Bitwise Operator
19
Important links
• My email: [email protected]
• My web page: DrAadil.com