Posts

Showing posts with the label final class java

final Keyword in Java जावा में फाइनल कीवर्ड

In Java, the final keyword is a special non-access modifier used to declare constants. When applied to variables, methods, or classes, it makes them unchangeable — meaning you cannot modify their value, override them, or extend them, respectively. जावा में final एक विशेष प्रकार का नॉन-एक्सेस स्पेसिफायर होता है जिसका उपयोग स्थिरांक (constant) बनाने के लिए किया जाता है। यदि हम किसी वेरिएबल, मेथड या क्लास के साथ final लगाते हैं, तो उसे भविष्य में बदला नहीं जा सकता। There are three main uses of the final keyword: final कीवर्ड का उपयोग मुख्य रूप से तीन स्थानों पर किया जाता है: 📌 a) Final Variable When a variable is declared with the final keyword, it becomes a constant. You must initialize it at the time of declaration. If not, it becomes a blank final , which can only be initialized in a constructor or a static block. जब किसी वेरिएबल को final कीवर्ड के साथ घोषित किया जाता है, तो वह एक स्थिरांक बन जाता है। इसे घोषित करते समय ही मान देना होता है, अन्यथा यह blank final कहलाता...