That's a clever way to study!
Here is a neat explanation for each topic, structured as the
Question (the prompt), the Core Concept (a simple, exam-ready definition), and Explanation
💻 Unit 3: Fundamentals & OOP
(key details for marks).
1. Write about [Link]?
● Core Concept: A public final field attached to every array object that stores the array's
fixed size.
● Explanation: It is used to get the number of elements the array can hold. Crucially, it is
a field, not a method, so you access it directly (e.g., [Link]). Since arrays are
fixed-size, this value is constant after creation.
2. What is an abstract method and class?
● Core Concept: Abstract members define a common interface but leave the
implementation details to subclasses.
● Explanation:
○ An Abstract Method has no body (implementation) and is marked with the abstract
keyword.
○ An Abstract Class must be declared abstract if it contains any abstract methods. It
cannot be instantiated (no objects can be created) and serves only as a base
class.
3. What are the applications of super keyword?
● Core Concept: The super keyword is a reference variable used inside a subclass to refer
to the immediate parent class object.
● Explanation: Its three primary uses are:
1. Calling the parent class's constructor (super()). Must be the first line in the
subclass constructor.
2. Accessing the parent class's method when it has been overridden in the subclass
([Link]()).
3. Accessing the parent class's instance variable when hidden by a same-named
variable in the subclass ([Link]).
4. Define Interface?
● Core Concept: A blueprint that defines a contract of behavior a class must fulfill, used to
achieve total abstraction.
● Explanation: An interface contains methods that are implicitly public abstract (before
Java 8). A class uses the implements keyword to adopt an interface. Interfaces are key
to supporting multiple inheritance of type in Java.
5. Define Inheritance?
● Core Concept: An OOP mechanism where a new class (subclass) acquires properties
(fields and methods) from an existing class (superclass).
● Explanation: It establishes an "is-a" relationship (e.g., Cat is a Feline) and is achieved
using the extends keyword. The main benefits are Code Reusability and supporting
Polymorphism.
6. Difference between array and vector?
● Core Concept: Both store collections, but Arrays are fixed-size and basic, while
Vectors are dynamic, synchronized collections.
● Explanation:
○ Array: Size is fixed at creation, not synchronized (not thread-safe), can hold
primitives or objects.
○ Vector: Size can grow/shrink dynamically, is synchronized (thread-safe, but
💥 Unit 4: Exceptions & Utilities
slower), part of the Collections Framework.
1. What is an Exception?
● Core Concept: An abnormal event that occurs during the program's execution, which
disrupts the normal flow of instructions.
● Explanation: Exceptions are objects that inherit from [Link]. They must be
handled using try-catch-finally blocks (checked exceptions) or are handled by the JVM
(unchecked/runtime exceptions like NullPointerException).
2. What is a package?
● Core Concept: A container used to group related classes and interfaces into a single
unit.
● Explanation: Packages provide an excellent way to organize code and manage visibility
through access control (e.g., package-private access). They also help prevent naming
conflicts between classes (e.g., two different files can have a Test class if they are in
different packages).
3. List two classes from the [Link] package?
● Core Concept: The [Link] package contains the Collections Framework and other
crucial utility classes.
● Explanation: Two key classes are:
1. ArrayList: A dynamic, resizable array implementation of the List interface.
2. Scanner: Used to parse primitive types and strings from input streams (like the
console or files).
4. Demonstrate Auto boxing and Auto unboxing?
● Core Concept: Automatic conversion between primitive types and their corresponding
Wrapper class objects.
● Explanation:
○ Autoboxing: Primitive to Wrapper (e.g., int x = 10; Integer obj = x;).
○ Auto-unboxing: Wrapper to Primitive (e.g., Integer obj = 20; int y = obj;).
○ This feature (introduced in Java 5) simplifies code and allows primitives to be used
easily within collections, which only store objects.
5. What is the use of throw keyword?
● Core Concept: Used to explicitly raise (generate) an exception within a method body.
● Explanation: The throw keyword must be followed by an instance of a Throwable class
(e.g., throw new ArithmeticException("Custom message");). It's essential for creating and
triggering custom exceptions or re-throwing caught exceptions. (Note the difference
⚙️ Unit 5: Multithreading & I/O
from throws, which is used in the method signature to declare an exception).
1. define Thread?
● Core Concept: A lightweight process and the smallest unit of execution within a
program.
● Explanation: Threads allow a single program to perform multiple tasks concurrently
(multithreading), leading to better CPU utilization and improved application
responsiveness. Threads are implemented in Java by extending the Thread class or
implementing the Runnable interface.
2. Define string? How are strings declared in java?
● Core Concept: An immutable sequence of characters implemented by the
[Link] class.
● Explanation: Immutability means a String object's value cannot be changed after
creation. Strings can be declared in two ways:
1. String Literal (Recommended): String s = "hello"; (Created in the String Constant
Pool for optimization).
2. Using new keyword: String s = new String("hello"); (Created directly on the Heap).
3. What is Daemons Thread?
● Core Concept: A low-priority background thread that provides services to user
threads.
● Explanation: The key property is that the JVM will exit once all user (non-daemon)
threads have finished, even if daemon threads are still running. Examples include the
Garbage Collector. You set a thread as a daemon using the setDaemon(true) method.
4. What is Deadlock?
● Core Concept: A situation where two or more threads are blocked indefinitely, each
waiting for a resource held by the other.
● Explanation: Deadlock occurs when threads possess resources (locks/monitors) and
simultaneously wait for additional resources held by other threads in the cycle. This
permanently prevents any of the threads involved from progressing.
5. What is JDBC?
● Core Concept: Java Database Connectivity. A standard API that enables Java
applications to connect to and interact with various databases.
● Explanation: JDBC provides a uniform set of interfaces in the [Link] package, allowing
developers to execute SQL statements (queries, updates) against any relational database
(like MySQL or Oracle) for which a JDBC driver is available.