Word: Method
Meaning: विधि
Pronunciation: मेथड
Short Description:
English: In programming, a method is a function that belongs to a class and is used to perform specific actions on objects.
Hindi: प्रोग्रामिंग में, विधि (मेथड) एक फ़ंक्शन होता है, जो किसी वर्ग (क्लास) से संबंधित होता है और वस्तुओं (ऑब्जेक्ट्स) पर विशिष्ट क्रियाएँ करने के लिए उपयोग किया जाता है।
Examples of ‘Method’ in Sentences:
# | English Sentence | Hindi Translation |
---|---|---|
1 | A method is used to define an object’s behavior. | एक विधि किसी वस्तु के व्यवहार को परिभाषित करने के लिए उपयोग की जाती है। |
2 | In Python, methods are defined using the ‘def’ keyword. | पाइथन में, विधियाँ ‘def’ कीवर्ड का उपयोग करके परिभाषित की जाती हैं। |
3 | The ‘drive’ method makes the car move forward. | ‘ड्राइव’ विधि कार को आगे बढ़ाती है। |
4 | Methods help in organizing and reusing code. | विधियाँ कोड को व्यवस्थित और पुनः उपयोग करने में मदद करती हैं। |
5 | Each class can have multiple methods. | प्रत्येक वर्ग में कई विधियाँ हो सकती हैं। |
6 | The ‘printDetails’ method displays the object’s information. | ‘printDetails’ विधि वस्तु की जानकारी प्रदर्शित करती है। |
7 | Methods in Java are written inside classes. | जावा में विधियाँ वर्गों के अंदर लिखी जाती हैं। |
8 | A method can take parameters and return values. | एक विधि पैरामीटर ले सकती है और मान वापस कर सकती है। |
9 | The ‘getName’ method returns the name of the student. | ‘getName’ विधि छात्र का नाम वापस करती है। |
10 | Private methods can only be accessed within the class. | निजी (प्राइवेट) विधियाँ केवल वर्ग के अंदर ही एक्सेस की जा सकती हैं। |
Short Story Using ‘Method’
Ravi was learning object-oriented programming. His mentor told him that a method is like an action that an object can perform. Ravi created a Robot class and added a speak() method. When he called the method, the robot printed “Hello, I am a robot!” He realized that methods make objects interactive and dynamic.