Evaluation Order of Java Operand Before applying any operator, all the Operands should be evaluated from left to right.
Tag: java operator
Precedence Of Java Operators Uniary Operators :- [ 1st level [ ], x++, x– ], [ 2nd level ++x, –x, ~, ! ], [ 3rd level new, <type> ]. Arithmetic Operators:- *, /, %, +, – . Shift Operators:- >>, >>>, << . Comparison Operators:- <, <=, >, >=, instance of, == . Bitwise Operators:- […]
The only ternary operator available in java is conditional operator. int a = ( 10<20 ) ? 30 : 40 ; System.out.println( a) ; // 30 Nesting of conditional operator is also allowed in java. int x = ( 100>200 ) ? 10 : ( (1000>3000) ? 20 : 30 ) ; System.out.println( x) ; […]
Assignments The following is the list of all possible compound assignment operator. + = & = % = – = | = >>> = * = ^ = << = / = >> = In the case of compound assignment operator, the required type casting is performed automatically by the compiler. byte b = 20 […]
Short Circuit Operators ( &&, || ) These operators are exactly same as normal operator |, ‘&’ except the following difference. General Operators ( &, | ) Short Circuit Operator ( &&, || ) Both arguments should be evaluated always. Second argument evaluation is optional. Relatively performance is low. Performance is high. Applicable for both […]
Relational Operators Relational operators ‘ >, >=, <, <= ‘ We have to apply these relational operators only for primitive data types except boolean. 10 > 20 // false ‘ a ‘ > 95 // true 10 < 10.5 // true true < false // ( compile time error ) We can’t apply relational operators […]
Arithmetic Operations ( +, -, *, /, % ) If we are performing any arithmetic operation between two variables a and b . The result is always type max ( type of a, type of b, int) byte + byte = int byte + short = int int + byte = int short + long […]