Expression Statement in Java जावा में एक्सप्रेशन स्टेटमेंट

In Java, expression statements are valid expressions that end with a semicolon ;. These are used to perform operations like assigning values, calling methods, or creating objects. Java supports mainly four types of expression statements: assignment expressions, increment/decrement expressions, method calling, and object creation expressions.

जावा में, एक्सप्रेशन स्टेटमेंट ऐसे वैध एक्सप्रेशन होते हैं जो अर्धविराम ; के साथ समाप्त होते हैं। इनका उपयोग वैल्यू असाइन करने, मेथड कॉल करने या ऑब्जेक्ट बनाने जैसे कार्यों को करने के लिए किया जाता है। जावा मुख्यतः चार प्रकार के एक्सप्रेशन स्टेटमेंट को सपोर्ट करता है: असाइनमेंट एक्सप्रेशन, इन्क्रीमेंट/डीक्रीमेंट एक्सप्रेशन, मेथड कॉलिंग और ऑब्जेक्ट क्रिएशन एक्सप्रेशन।

1️⃣ Assignment Expression

Assignment expressions are used to assign values to variables. These include simple assignments as well as compound assignments like +=, -=, *=, etc.

a += 5;
b *= 7;
c = 3;

असाइनमेंट एक्सप्रेशन का उपयोग वैरिएबल्स को मान असाइन करने के लिए किया जाता है। इसमें साधारण असाइनमेंट के साथ-साथ +=, -=, *= जैसे संयुक्त असाइनमेंट भी शामिल होते हैं।


2️⃣ Increment and Decrement Expression

These expressions are used to increase or decrease the value of a variable using prefix or postfix operators.

++a;
--b;
c++;
d--;

इन एक्सप्रेशन्स का उपयोग वैरिएबल के मान को बढ़ाने या घटाने के लिए किया जाता है। इसमें प्रीफिक्स (++a, --b) और पोस्टफिक्स (c++, d--) दोनों प्रकार के ऑपरेटर आते हैं।


3️⃣ Method Calling Expression

A method call can also be an expression statement in Java, regardless of whether the method returns a value or not.

obj.factorial();

जावा में, कोई भी मेथड कॉल एक एक्सप्रेशन स्टेटमेंट हो सकता है, चाहे वह मेथड कोई मान लौटाए या नहीं।


4️⃣ Object Creation Expression

Creating an object using the new keyword is also a valid expression statement in Java.

Test t = new Test();

new कीवर्ड का उपयोग करके ऑब्जेक्ट बनाना भी जावा में एक वैध एक्सप्रेशन स्टेटमेंट होता है।


➕ Arithmetic Expression and Its Solution

Arithmetic expressions involve the use of mathematical operators like addition (+), subtraction (-), multiplication (*), division (/), and modulus (%). A single-mode arithmetic expression uses operands of the same data type, such as integer or floating-point. Let’s assume A = 10 and B = 5, and see how different arithmetic operators work.

अंकगणितीय एक्सप्रेशन में गणितीय ऑपरेटरों जैसे जोड़ (+), घटाव (-), गुणा (*), भाग (/) और शेषफल (%) का उपयोग होता है। एक सिंगल-मोड अंकगणितीय एक्सप्रेशन में सभी ऑपरेण्ड समान प्रकार के होते हैं, जैसे कि इन्टिजर या फ्लोट। मान लीजिए A = 10 और B = 5, तो देखें विभिन्न ऑपरेटर कैसे कार्य करते हैं।


🔢 Table of Arithmetic Expressions

Operator Operation Expression & Result
+            Addition              A + B = 15
- Subtraction A - B = 5
* Multiplication A * B = 50
/ Division A / B = 2
% Modulus A % B = 0


✅ Conclusion

Understanding expression statements is key to writing functional Java programs. They allow you to perform tasks like assigning values, updating variables, calling functions, or instantiating objects. Arithmetic expressions help in performing mathematical operations efficiently.

एक्सप्रेशन स्टेटमेंट्स को समझना कार्यात्मक जावा प्रोग्राम लिखने के लिए आवश्यक है। ये वैल्यू असाइन करने, वैरिएबल अपडेट करने, फंक्शन कॉल करने या ऑब्जेक्ट बनाने जैसे कार्यों को करने में मदद करते हैं। अंकगणितीय एक्सप्रेशन गणनात्मक कार्यों को कुशलता से करने में सहायता करते हैं।

Comments

Popular posts from this blog

What is a Web Browser? वेब ब्राउज़र क्या है?

Java's Support System जावा का सहयोगी तंत्र

The Internet and Java इंटरनेट और जावा का सम्बन्ध