Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 3 : Method hiding / मेथड हाइडिंग

Advertisement

Detailed Solution

सही उत्तर Method hiding / मेथड हाइडिंग है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

A subclass declares a `static` method with the same signature as a `static` method in its superclass. In Java, this is called: / एक subclass अपने superclass के `static` मेथड के समान signature वाला `static` मेथड घोषित करता है। Java में इसे कहते हैं:

1.
Overriding / ओवरराइडिंग
2.
Compilation error — static methods cannot share signatures / कंपाइलेशन त्रुटि — static मेथड समान signature साझा नहीं कर सकते
3.
Method hiding / मेथड हाइडिंग
4.
Overloading / ओवरलोडिंग

Correct Answer: Method hiding / मेथड हाइडिंग

Static methods belong to the class, not instances, so they cannot be overridden — the subclass version merely hides the superclass one, and the call is resolved at compile time by the reference type. The trap is treating it like instance-method overriding with runtime polymorphism. / static मेथड क्लास के होते हैं, instance के नहीं, अतः इन्हें override नहीं किया जा सकता — subclass संस्करण superclass वाले को केवल hide करता है, और कॉल reference type के आधार पर compile समय पर resolve होता है। जाल इसे runtime polymorphism वाले instance-method overriding जैसा समझना है।

Downloaded from PrepSnap (prepsnap.in)