Overview of Operator
Java is a very versatile programming language. It is versatile because of many good features. One of the feature it provide is power of Operators. Operators are essential requirement for a good programming language. Java provides a wide set of Operators. These operators help programmer to get the functionality to operate over variables. Generally in Java there are two types of operators:-
1. Unary Operators
They are operators which operate on single operand.
2. Binary Operators
They are operators which operate on two operands.
There are also many classes of Operators some of them are :
1. Arithmetic Operator
2. Comparison Operator
3. Assignment Operator
5. Bitwise Operator
6. Boolean Operator
Lets have a look to all of the Operators listed above :
The Java programming language uses arithmetic operators very extensively. Arithmetic operators are used where we have to perform basic mathematical computations. The mathematical computations such as addition, subtraction, division, multiplication etc .
Java provides us with a set of comparison operators which compares value of one variable to value of another variable and based on comparison helps us to build a expression. Generally these sort of operators are been used in the if-else contructs. Generally expression built by these operators are either true or false. It means they will return either true value or false value. This helps in flow of code in if-else constructs.
Java provides us with a set of assignment operators which are normally used to give a value to a variable. After performing mathematical calculations or say conditions
Java provide us with a ternary operator which performs functionality of a if-else constructs. Generally conditional operator uses expression for two variables if condition is true it executes code and if not it executes some other code.
Bitwise Operators are quite tricky and complex operators in Java. Generally when a Java application transfer information over a network to a method written in a different programming language we need to do the data conversion. Bitwise operators are used to convert one value to another at bit-level.
Generally Boolean Operator are mainly three in number. Lets look into their usage :
Generally if a Java expressions contains two or more than two different operators in a statement compiler decides to evaluate which operator first by the concept of operator precedence. Generally Operator Precedence table is followed when evaluating the expression.
For more of such hot topics read my other posts here :