OPERATORS:
Operators in Java
Operator in java is a symbol which is used to perform operations. For example: +, -, *, / etc.
- There are many types of operators in Java which are given below:
- Unary Operator
- Arithmetic Operator
- Shift Operator
- Relational Operator
- Bit wise Operator
- Logical Operator
- Ternary Operator and
- Assignment Operator
The ? Operator:
Syntax: Result = expression ? incase true : incase false;
If expression is true then true case is executed. When expression is false then false case is executed.
e.g. stringResult = age < 12 ? “child” : “adult”;
Post a Comment
Post a Comment
Please do not enter any spam link in the comment box