Evaluation Order of Java Operand Before applying any operator, all the Operands should be evaluated from left to right. NarayanaswamyHello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in the IT industry for more than 12 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, […]
Category: SCJP
Precedence Of 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:- […]
New Operator
New Operator New operator can be used for the creation of Object. Note:- There is no delete operator in java, Destruction of useless Objects will take care by Garbage Collector. NarayanaswamyHello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in the IT industry for more than 12 years. NarayanaTutorial is my […]
Conditional Operator
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) ; […]
Assignment Operator
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 […]
Instance Of Operator
Instance Of Operator Syntax:- t instanceof x t ==> Object / Obj reference. x ==> class name / interface Ex:- Thread t = new Thread ( ) ; System.out.println ( t instanceof Thread ) ; // true System.out.println ( t instanceof Object ) ; // true System.out.println ( t instanceof Runnable ) ; // […]
Types Cast Operator
Type Cast Operator There are two types of primitive type castings a possible. implicit type casting explicit type casting Implicit Type Casting Compiler is responsible for this type casting. performed automatically where ever we are assigning smaller value to the bigger data type It is also known as Widening or up casting There is no […]
Short Circuit Operators
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 […]
Bitwise Operators
Bitwise Operators & –> If both operands are true, then the result will be true. Ι –> If at least one arg is true, then the result is true. ∧ ( XOR ) –> If both args are different the result is true. s.o.p ( true & false ) ; // false s.o.p ( true […]
Equality Operator
Equality Operator (= =), (!) We can apply equality operators for all primitive data types including boolean also. 10 = = 20 ; // true ‘ a ‘ = = 97 ; // true 10 = = 10.0 ; // true true = = true ; // true We can apply equality operators even for […]