Java OOP – Important Questions and Answers
1. Classes and Objects in Java
A class is a blueprint used to create objects. An object is an instance of a class that represents
real-world entities.
2. Student Class Program
A Student class contains data members like roll number, name, and marks, and methods to display
details.
3. Employee Class Program
An Employee class stores employee id, name, and salary and displays employee details using
methods.
4. Instance and Static Methods
Instance methods belong to objects, while static methods belong to the class and can be called
without objects.
5. this and super Keywords
The this keyword refers to the current class object, while super refers to the parent class object.
6. final Keyword
The final keyword is used to restrict modification of variables, methods, and classes.
7. Class Members in Java
Class members include instance variables, static variables, local variables, instance methods, and
static methods.
8. Method Overloading
Method overloading allows multiple methods with the same name but different parameters in a
class.
9. Instance vs Static Variables
Instance variables have separate copies per object, while static variables are shared among all
objects.
10. Method Overriding
Method overriding allows a subclass to provide a specific implementation of a method defined in its
parent class.
--- End of Document ---