Java Programming - Important Questions (with Hindi Explanation in English)
Q1. What is Java? Write any 4 features.
Java is a high-level, object-oriented, platform-independent programming language.
Features:
1. Simple
2. Platform Independent
3. Object-Oriented
4. Secure
Hindi Explanation:
Java ek high-level programming language hai jo object-oriented aur platform-independent hai.
Features: Saral, Platform Swatantra, Object-Oriented, Surakshit
Q2. What are OOPs concepts? Explain Inheritance.
OOPs Concepts: Inheritance, Polymorphism, Encapsulation, Abstraction
Inheritance: One class inherits features from another class.
Hindi Explanation:
OOPs ke 4 concepts hote hain - Inheritance (virasat), Polymorphism (bahurupata), Encapsulation (band
karna), Abstraction (chhupana)
Inheritance mein ek class doosri class ke methods ko use karti hai.
Q3. Difference between Method Overloading and Overriding
Overloading: Same class, same method name, different parameters.
Overriding: Subclass defines parent class method again.
Hindi Explanation:
Overloading: Ek hi class mein alag parameters ke saath same method.
Overriding: Parent class ke method ko subclass mein dobara likhna.
Java Programming - Important Questions (with Hindi Explanation in English)
Q4. What is Exception Handling? Explain try-catch-finally.
Exception handling is used to handle errors during runtime.
try: risky code, catch: handles exception, finally: always executes.
Hindi Explanation:
Exception handling ka use run time errors handle karne ke liye hota hai.
try: jahan error ho sakta hai, catch: error handle karta hai, finally: hamesha execute hota hai.
Q5. Difference between while and do-while loop
while: condition checked before loop, may not run.
do-while: condition checked after loop, runs at least once.
Hindi Explanation:
while: loop chalne se pehle condition check hoti hai.
do-while: pehle ek baar loop chalta hai, fir condition check hoti hai.
Q6. Applet Life Cycle
init(), start(), paint(), stop(), destroy()
Hindi Explanation:
Applet ke 5 stages hote hain: init (shuru), start (chalana), paint (display), stop (rokna), destroy (hatana)
Q7. What is Constructor? Types of Constructor
Constructor is used to initialize objects.
Types: Default and Parameterized
Hindi Explanation:
Constructor object banate waqt call hota hai. 2 prakar ke hote hain - Default aur Parameterized.