Unit 1: Basics of Java Programming
• Object-Oriented Programming (OOP) Concepts:
o Class: A blueprint or template for creating objects. It encapsulates attributes
(variables) and methods (functions).
o Object: A real-world entity and a basic component of OOP. It is an instance of a
class with specific states and behaviors.
o Encapsulation: The process of binding data members and methods together. It
restricts direct access to data to improve security.
o Inheritance: Allows a new class (child/derived) to reuse the functionalities and
properties of an existing class (parent/base).
o Polymorphism: Meaning "many forms," it allows a single entity to take different
forms through method overloading or overriding.
o Abstraction: A technique to hide internal implementation details while showing
only essential functionalities.
• Java History & Features:
o Origin: Created by James Gosling at Sun Microsystems in 1995; originally named
"Oak".
o Slogan: "Write Once, Run Anywhere (WORA)" due to platform independence.
o Key Features: Simple (no pointers), object-oriented, robust (exception
handling), secure, multithreaded, and high-performance (via JIT compilation).
• Language Basics:
o Comments: Includes single-line (//), multi-line (/*...*/), and documentation
(/**...*/) for explaining logic and improving readability.
o Data Types: Primitive (byte, short, int, long, float, double, char, boolean) and
Non-Primitive (Arrays, Strings, Classes, Interfaces).
o Variables: Containers for data. Types include Local (inside methods), Instance
(outside methods), and Static (shared among objects).
o Constants: Declared with the final keyword; once assigned, their value cannot
be changed.
o Operators: Arithmetic (+, -, *, /, %), Relational (==, !=, >, <), Logical (&&, ||, !),
Assignment (=, +=), Unary (++, --), Bitwise (&, ^, <<), and Ternary (? :).
o Type Conversion: Implicit (automatic, small to large type) and Explicit (manual
casting, large to small type).
• Control Flow:
o Conditional Statements: if, if...else, else if ladder, and switch.
o Loops: for (known iterations), while (entry-controlled), do-while (executes at
least once), and for-each (simplified iteration for arrays).
• Arrays: Collections of same-type elements in contiguous memory. Supports 1D and
Multidimensional (2D/3D) formats.
• Program Execution: Two-step process involving Compilation (javac converts source
code to bytecode) and Execution (java runs bytecode via JVM).
Unit 2: Advanced OOP and Inheritance
• Inheritance Implementation: Uses the extends keyword.
o Subclass and Superclass: A subclass inherits all accessible members from its
superclass but can add its own.
o Access Modifiers: Public and protected members are accessible in subclasses;
private members are not.
• Polymorphism Types:
o Compile-Time (Static): Method Overloading—same name, different parameters
within the same class.
o Runtime (Dynamic): Method Overriding—subclass provides a specific
implementation of a method defined in the superclass.
• Final Keyword:
o Final Class: Cannot be inherited (extended).
o Final Method: Cannot be overridden by subclasses.
• Interfaces: Used to achieve multiple inheritance and total abstraction.
o Defined with interface and implemented using implements.
o Contain only abstract methods (no bodies) and final fields (constants).
• Packages: Namespaces to group related classes.
o Built-in: e.g., [Link], [Link].
o User-defined: Created using the package keyword at the top of the file.
Unit 3: Multithreading and JDBC
• Multithreading: Allows multiple threads to execute concurrently to improve
performance.
o Thread Priorities: Range from 1 (MIN_PRIORITY) to 10 (MAX_PRIORITY), with a
default of 5 (NORM_PRIORITY).
o Priority acts as a suggestion to the thread scheduler.
• JDBC (Java Database Connectivity):
o Driver Types:
▪ Type-1: JDBC-ODBC Bridge (needs ODBC installed on client).
▪ Type-2: Native-API Driver (uses client-side database libraries).
▪ Type-3: Network Protocol Driver.
▪ Type-4: Thin Driver (pure Java, converts calls directly to database
protocol).
o Steps for Connectivity:
1. Load Driver: Use [Link]().
2. Establish Connection: Use [Link](url, user,
pass).
3. Create Statement: Use [Link]().
4. Execute Query: executeQuery() for SELECT (returns ResultSet);
executeUpdate() for INSERT/UPDATE/DELETE (returns number of rows
affected).
5. Close Connection: Use [Link]().