Header Ads Widget

Ticker

6/recent/ticker-posts

Difference between Interface and Abstract Class in hindi

Difference between Interface and Abstract Class in hindi


कोई भी java interview में यह सबाल बहुत बार पूछा जाता है ,यदि आप 10 interview में जायेंगे तो आपको 7 interview में यह टॉपिक मिलेगा .Difference between Interface and Absract Class ? ,what are various difference interface and abstract ?, when you should go for interface and when you should go for abstract ? इसी type के questionआपको interview रूम में पूछा जायेगा .

तो चलिए में आपको 7-8 difference बताता हूँ Interface and Absract Class  के बारे में -

Interface-

1-जब आपको implementation के बारे में कुछ भी नही पता होता है केबल आपको specification करना है तब interface use किया जाता है .

2-interface के अन्दर सभी method public and abstract होता है ,आप लिखे इया न लिखे इए by default होता है .इसीलिए इसे 100% pure abstract class कहा जाता है .

3-interface के अन्दर private,protected,final,static,strictfp,native and synchronized allow नही होता है .

4-interface के variables हर time static,final and public होता है .आप declare करो या ना करो .

5-interface variable में आप private,protected,volatile and transient modifiers allow नही होता है .

6-interface class के अन्दर जब भी आप variable declare करते हो तो उसका value initialization करना जरुरी है .

7-interface के अन्दर आप static block and instant block allow नही है .

8-interface के अन्दर आप constructor allow नवही है .

Abstract Class-

1-जब आपको implementation के बारे में पता है लिकिन total implementation नही पता है तब abstract class किया जाता है .

2-abstract class के अन्दर दोनों abstract and concrete method लिखा जा सकता है .

3-abstract class के अन्दर सब कुछ allow है .

4-abstract class variable में आप सब modifiers use कर सकते हैं .

5-abstract class में किसी type का variable initialization नही किया तो कुछ भी error नही देखायेगा .

6-abstract class के अन्दर static and instance block allow है .

7-abstract class के अन्दर आप constructor  को allow कर सकते हैं .

तोह यह था पूरा टॉपिक यदि आपको कुछ भी सबल है तो आप निचे comment करके पुच सकते हैं .

More Articles

Post a Comment

0 Comments