Java Operators
- Introduction to java operators in Hindi
- Types of java operators in Hindi
Introduction to Java Operators
जैसा की आप सब जानते है operators का उपयोग आप variables पर operations perform करने के लिए करते है। हर data type पर अलग अलग operations perform किये जाते है। इसलिए operators भी अलग अलग यूज़ होते है।
Operators unary और binary 2 प्रकार के होते है। Operators के साथ यूज़ होने वाले variables को operand कहते है। Unary operators एक operand के साथ apply होते है और binary operators 2 operands पर apply होते है।
Java में मुख्यतः 6 type के operators होते है।
- Arithmetic operators
- Logical operators
- Bit wise operators
- Relational operators
- Assignment operators
- Conditional operators
Arithmetic Operators
Arithmetic operators mathematical computation perform करने के लिए यूज़ किये जाते है। Arithmetic operators 5 type के होते है। इनके बारे में निचे दिया जा रहा है।
Operator
|
Explanation
|
Example
|
Logical Operators
Logical operators boolean values पर operations perform करने के लिए यूज़ किये जाते है। ये operators 3 तरह के होते है। इस तरह के operations में दोनों variables की value true या false हो सकती है। Logical operators के बारे में निचे दिया जा रहा है।
Operator
|
Explanation
|
Example
|
Bit-wise Operators
Bit-wise operators bit by bit operations perform करने के लिए यूज़ किये जाते है। ये operators variables की values को bits में convert करके उन पर operations perform करते है। Bit wise operators 4 तरह के होते है। इनके बारे में निचे दिया जा रहा है।
Operator
|
Explanation
|
Example
|
Relational Operators
Relational operators 2 variables के बीच में relation को पता लगाने के लिए यूज़ किये जाते है। इनका प्रयोग ज्यादातर if statement में किया जाता है। इन operators से आपको 2 variables के बीच में relation का पता चलता है जैसे की क्या दोनों variables बराबर है या एक छोटा और एक बड़ा है।
Operator
|
Explanation
|
Example
|
Equal to (==)
|
a==b
| |
Not equal to(!=)
|
a!=b
| |
Greater than(>)
|
a>b
| |
Less than(<)
|
a<b
| |
Greater than equal to (>=)
|
a>=b
| |
Less than equal to (<=)
|
a<=b
|
Assignment Operators
Assignment process को simple और fast बनाने के लिए java कुछ assignment operators provide करती है। इनके बारे में निचे दिया जा रहा है।
Operator
|
Explanation
|
Example
|
Simple assignment (=)
|
a=b;
| |
Plus assignment (+=)
|
a+=b;
| |
Minus assignment(-=)
|
a-=b
| |
Multiply assignment(*=)
|
a*=b
| |
Divide assignment(/=)
|
a/=b
|
Conditional Operator (?:)
Conditional operator java का special operator होता है जो if statement की तरह काम करता है। इसे ternary operator भी कहते है। ये variables में conditions के according values store करने के लिए यूज़ किया जाता है। इस operator में ? से पहले एक condition दी जाती है , यदि वो condition true है तो colon से पहले वाली value नहीं तो colon के बाद वाली value variable में store होती है।
Example
a=5, b=3;
c= a>b?a:b; // c में a की value store की जाएगी।



No comments:
Post a Comment