1. CAN THE MAIN METHOD BE OVERLOADED?
ANS:- Yes, the main() method can be overloaded in Java. Multiple main methods can be
defined with different parameter lists. However, JVM only executes the standard
main(String[] args) method. Other overloaded versions are not called automatically.
They must be invoked manually from the main method.
2. WHAT IS THE DIFFERENCE BETWEEN == & = OPERATOR?
ANS:- The = operator is used for assigning values to variables. The == operator is used for
comparing two values. It returns true if both values are equal. For objects, == compares
memory references. Thus, both operators have different purposes.
3. WHY JAVA IS NOT A PURE OBJECT ORIENTED LANGUAGE?
ANS:- Java is not purely object-oriented because it uses primitive data types like int, float,
etc. These are not objects. A pure OOP language requires everything to be an object. Java
also supports static methods. Hence, it is not fully object-oriented.
4. WHAT IS INHERITANCE?
ANS:- Inheritance is a feature where one class acquires properties of another class. The
existing class is called the superclass, and the new class is called the subclass. It helps in code
reusability. It also reduces redundancy. It supports method overriding.
5. WHAT IS FINAL AND CONST IN JAVA?
ANS:- The final keyword is used to restrict changes in Java. A final variable cannot be
modified after assignment. A final method cannot be overridden. A final class cannot be
inherited. The const keyword is reserved but not used in Java.
6. WHAT IS RUN TIME ERROR? GIVE AN EXAMPLE.
ANS:- A runtime error occurs during program execution. It happens after successful
compilation. These errors can crash the program. They are not detected at compile time.
Example: division by zero causes an ArithmeticException.
1
7. WHAT IS A FINAL KEYWORD? WHEN DO WE DECLARE A
METHOD OR CLASS AS FINAL?
ANS:- The final keyword is used to prevent modification. A method is declared final to
stop overriding. A class is declared final to prevent inheritance. It ensures security and fixed
behavior. It is used when changes are not allowed.
8. WHAT DO YOU MEAN BY DATA ENCAPSULATION?
ANS:- Data encapsulation means wrapping data and methods into a single unit. It is achieved
using classes. Variables are kept private to restrict direct access. Access is provided through
getter and setter methods. It improves security and control.
9. WHAT IS MEAN BY ABSTRACTION?
ANS:- Abstraction means hiding implementation details. It shows only important features to
the user. It reduces complexity of the program. It is achieved using abstract classes and
interfaces. It focuses on essential information.
10. WHAT IS STATICS MEMBER CLASS?
ANS:- A static member class is a class declared with the static keyword inside another
class. It can be accessed without creating an object of the outer class. It can access only static
members of the outer class. It helps in better organization of code.
11. WHAT IS AN OBJECT?
ANS:- An object is an instance of a class. It represents real-world entities. It contains
properties and behaviors. Objects are created using the new keyword. Each object has its own
state and memory.
Created by ;
Debapriyo Chatterjee