Posts

Showing posts with the label java object creation

Java Class Object - Explained with Example क्लास ऑब्जेक्ट - उदाहरण सहित

An object is a real-world entity that contains both properties (data) and behaviors (methods). In Java, an object is an instance of a class that represents its existence. For example – pen, pencil, calculator, car, or mobile. A class object can be logical or physical and it holds the following: वास्तविक दुनिया की एक ऐसी इकाई जिसमें गुण (डेटा) और व्यवहार (क्रियाएँ) दोनों होते हैं, उसे  ऑब्जेक्ट  कहा जाता है। जावा में, एक ऑब्जेक्ट किसी क्लास का instance (उदाहरण) होता है, जो उस क्लास के अस्तित्व को दर्शाता है। जैसे – पेन, पेंसिल, कैलकुलेटर, कार, मोबाइल आदि। एक क्लास ऑब्जेक्ट तार्किक या वास्तविक हो सकता है जिसमें निम्न होते हैं: Property – Represents the class's variables. गुण (Property)  – क्लास के वेरिएबल को दर्शाता है। Behavior – Represents the class's methods. व्यवहार (Behavior)  – क्लास की मेथड को दर्शाता है। In real life, a student is an object with properties like roll number, name, and marks, and behaviors like mark sheet generation, admit card printing, or...

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; असाइनमेंट एक्सप्रेशन का उपयोग वैरिएबल्स को मान असाइन करने के लिए किया जाता ...