SCJP: Java Operators #Java Short Notes #SCJP

Exams like SCJP test your understanding of Java operators and how to use them like:
assignment operators: =, +=, -=
arithmetic operators: +, -, *, /, %, ++, --
relational operators: < , , >=, ==, !=
logical operators: &, |, ^, !, &&, ||
conditional operators: ? :
Also operators to check the equality of two objects or two primitives

In the following table operators and their precedences are shown. Upper rows operators have higher precedence. Same row operators have equal precedence. For equal precedence operators, All binary operators except the assignment operators work from left to right while assignment operators work from right to left.

Operator Precedence
Operators Precedence
postfix expr++ expr--
unary ++expr --expr +expr -expr ~ !
multiplicative * / %
additive + -
shift < > >>>
relational = instanceof
equality == !=
bitwise AND &
bitwise exclusive OR ^
bitwise inclusive OR |
logical AND &&
logical OR ||
ternary ? :
assignment = += -= *= /= %= &= ^= |= < >= >>>=

The following quick reference summarizes the operators supported by the Java programming language.

Simple Assignment Operator

=	Simple assignment operator

Arithmetic Operators

+ 	Additive operator (also used for String concatenation)- 	Subtraction operator*	Multiplication operator/ 	Division operator%	Remainder operator

Unary Operators

+ 	Unary plus operator; indicates positive value (numbers are positive without this, however)- 	Unary minus operator; negates an expression++  	Increment operator; increments a value by 1--    	Decrement operator; decrements a value by 1!     	Logical compliment operator; inverts the value of a boolean

Equality and Relational Operators

==	Equal to!=	Not equal to>	Greater than>=	Greater than or equal to< Less than<=	Less than or equal to

Conditional Operators

&& 	Conditional-AND|| 	Conditional-OR?:      Ternary (shorthand for if-then-else statement)

Type Comparison Operator

instanceof	Compares an object to a specified type 

Bitwise and Bit Shift Operators

~	Unary bitwise complement< >	Signed right shift>>>	Unsigned right shift&	Bitwise AND^	Bitwise exclusive OR|	Bitwise inclusive OR

Details about java operators

From: http://sitestree.com/?p=4848
Categories:Java Short Notes, SCJP
Tags:
Post Data:2012-12-29 02:01:30

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Leave a Reply