Java & OOPs Viva Preparation Guide
Comprehensive One-Line Answers for Quick Learning
CORE JAVA & OOPS BASICS
Q: What is OOPs with Java and its usage?
A: Object-Oriented Programming is a paradigm that organizes software design around objects
(data) rather than logical functions, used to build modular, reusable, and scalable code.
Q: What is a Class?
A: A class is a logical blueprint or template from which objects are created.
Q: What is an Object?
A: An object is a physical instance of a class that exists in memory and has state and behavior.
Q: What is the difference between Object vs Class?
A: A class is a theoretical blueprint, whereas an object is a real-world entity created from that
blueprint.
Q: What is an API?
A: An Application Programming Interface is a set of rules and protocols that allows different
software applications to communicate with each other.
METHODS & VARIABLES
Q: What is a Method?
A: A method is a block of code that performs a specific task and only executes when it is called.
Q: What are Getters?
A: Getters are methods used to retrieve or read the value of a private variable.
Page 1 of 5
Q: What are Setters?
A: Setters are methods used to modify or update the value of a private variable.
Q: What is a Local Variable?
A: A variable declared inside a method, constructor, or block that is only accessible within that
specific scope.
Q: What is a Static Variable?
A: A variable that belongs to the class itself rather than any specific instance, sharing a single copy
among all objects.
Q: What is a Final Variable?
A: A variable whose value becomes a constant and cannot be changed once it has been initialized.
MEMORY & OBJECT LIFECYCLE
Q: What is a Constructor?
A: A special method with the same name as the class, used to initialize objects when they are
created.
Q: What are the types of Constructors?
A: There are default constructors (no arguments) and parameterized constructors (takes arguments
to set initial values).
Q: What is the use of the "this" keyword?
A: It is a reference variable used to refer to the current object invoking the method or constructor.
Q: What is the use of the "new" keyword?
A: It is used to instantiate new objects and allocate memory for them on the heap at runtime.
Q: What is the Garbage Collector?
A: An automated memory management process in Java that destroys unused objects to free up
heap memory.
Page 2 of 5
PILLARS OF OOPS & ADVANCED CONCEPTS
Q: What is Abstraction?
A: The process of hiding implementation details and showing only the essential features of an
object to the user.
Q: What is Inheritance?
A: A mechanism where one class (child) acquires the properties and behaviors of another class
(parent) to promote code reusability.
Q: What is an Interface?
A: A completely abstract blueprint used to group related methods with empty bodies, ensuring a
class implements specific behavior.
Q: What is an Abstract Class?
A: A class declared with the `abstract` keyword that cannot be instantiated and may contain both
abstract and concrete methods.
Q: What is an Abstract Method?
A: A method declared without a body that must be overridden and implemented by child classes.
Q: What is Method Overloading?
A: Creating multiple methods in the same class with the same name but different parameters
(compile-time polymorphism).
Q: What is Method Overriding?
A: Providing a specific implementation in a subclass for a method that is already defined in its
parent class (runtime polymorphism).
Q: What is Static Binding?
A: The process of linking a method call to its implementation at compile-time, such as in method
overloading.
Page 3 of 5
Q: What is the use of the "super" keyword?
A: A reference variable used to refer to the immediate parent class object, methods, or
constructors.
DATA TYPES, ARRAYS & CONTROL FLOW
Q: What are Basic Data Types?
A: Primitive building blocks like int, float, boolean, and char used to store simple values in memory.
Q: What is the Main Class / Main Method?
A: The class containing the `public static void main(String[] args)` method, which serves as the
entry point where program execution begins.
Q: What are Conditional Statements?
A: Statements like if, else if, and switch that execute different blocks of code based on whether a
specific condition is true or false.
Q: What is a For Loop?
A: A control flow statement that repeats a specific block of code a known number of times.
Q: What is a While Loop?
A: A control flow statement that repeatedly executes a block of code as long as a given condition
remains true.
Q: What is a Do-While Loop?
A: A loop that executes the block of code at least once before evaluating the condition to see if it
should repeat.
Q: What is an Array?
A: A data structure that stores a fixed-size, sequential collection of elements of the same data type.
Q: What is an Array of Objects?
A: An array where each element stores a reference variable pointing to an object, rather than a
primitive data type.
Page 4 of 5
ACCESS MODIFIERS & DATABASES
Q: What is Public?
A: An access modifier that allows a class, method, or variable to be accessible from anywhere in
the program.
Q: What is Private?
A: An access modifier that restricts access to a class, method, or variable only within the class it is
declared.
Q: What is the use of the "static" keyword?
A: Used for memory management to indicate that a member belongs to the class itself rather than
individual instances.
Q: What is JDBC?
A: Java Database Connectivity is an API used by Java applications to connect to and execute
queries on a database.
Q: What is MySQL?
A: A popular open-source relational database management system used to store, organize, and
manage data.
Page 5 of 5