ALL MODULES
Concept ↔ Suitable Program from Given 12 Programs
Substitute Program (From
No. Topic / Concept Why It Matches
Given 12)
1 Arrays (1D / 2D) Program 1 – Matrix Addition Uses 2D arrays and loops
Command Line
2 Program 1 – Matrix Addition Uses args[0]
Argument
Program 2 – Stack User-defined class with object
3 Class & Object
Implementation creation
Program 3 – Employee Salary Uses parameterized
4 Constructor
Raise constructor
ID, name, salary are instance
5 Instance Variables Program 3 – Employee
variables
Private variables with
6 Encapsulation Program 4 – MyPoint Class
methods
7 Method Overloading
Program 4 – MyPoint Multiple distance() methods
Program 5 – Polymorphism Circle, Triangle, Square extend
8 Inheritance
Demo Shape
Program 5 – Polymorphism
9 Runtime Polymorphism Overriding draw() and erase()
Demo
Program 6 – Abstract Class Abstract class with abstract
10 Abstraction
Demo methods
Resizable interface
11 Interface Program 7 – Interface Demo
implemented
12 Inner Class Program 8 – InnerClassDemo Inner class inside Outer
13 Package Program 9 – PackageDemo Uses package and import
14 Exception Handling Program 10 – DivisionByZero try-catch-finally block
15 Custom Exception Program 10 – DivisionByZero User-defined exception class
Multithreading Program 11 – Implements Runnable
16
(Runnable) RunnableThreadDemo interface
Multithreading (Thread
17 Program 12 – lab12 Extends Thread class
class)
Program 2 – Stack
18 Stack (Data Structure) Push, Pop operations
Implementation
19 Looping Concepts Program 1, 2, 11, 12 Uses for-loops
Method Definition &
20 Program 3, 4, 10 User-defined methods
Calling
� Quick Replacement Guide (Very Important for Exams)
If examiner asks topic → You can write this program:
Arrays → Program 1
Stack using array → Program 2
Constructor demo → Program 3
Encapsulation → Program 4
Polymorphism → Program 5
Abstract class → Program 6
Interface → Program 7
Inner class → Program 8
Package → Program 9
Exception handling → Program 10
Multithreading (Runnable) → Program 11
Multithreading (Thread class) → Program 12
� Important Note
Some topics cannot be substituted using these 12 programs directly:
Topic Available in Given 12?
Bitwise Operators ❌ Not Present
Shift Operators ❌ Not Present
Ternary Operator ❌ Not Present
Linear Search ❌ Not Present
Prime Check ❌ Not Present
If Statement Types (explicit demo) ❌ Not Separate Program
For those topics, separate small programs are needed.
Module 1
Suitable Programs from Given 12 Lab Programs
[Link] Question Topic Suitable Lab Program Why Suitable
Bitwise & Short Circuit Small separate program
1 ❌ Not directly in 12
Operators needed
Can show in Stack
2 If Statements & Labeled Break ❌ Not directly in 12
Program (Program 2)
Variable Scope, Compound Program 3 – Employee Shows instance variables
3
Assignment, Ternary Salary Raise & operations
4 Linear Search ❌ Not in 12 Separate program
5 Prime Number ❌ Not in 12 Separate program
Shows instance variables
6 Data Types & Default Values Program 4 – MyPoint Class
& data types
Theory – No specific
7 Compile Once Run Anywhere JVM concept
program
Program 3 – Employee /
8 Primitive Data Types Uses int, double, etc.
Program 4 – MyPoint
9 Operators & >> >>> ❌ Not directly in 12 Separate small demo
Program 1 – Matrix
10 Matrix Addition Exact match
Addition
� Best Substitutions for Exam
If examiner asks → Write this lab program:
� Data Types → Program 3 or 4
� Variable Scope → Program 3 (Employee)
� Arithmetic Operations → Program 3
� Matrix Addition → Program 1
� If/Else Example → Program 2 (Stack operations)
� Operators → Show in Program 1 or 3 (basic arithmetic)
Topics NOT Covered in Given 12
You must write separate small programs for:
Bitwise operators
Linear search
Prime number
and >>> demonstration
Safe Strategy for Exam
If question is:
About Matrix / Arrays → Write Program 1
About Variables / Data Types / Scope → Write Program 3
About If conditions → Write Program 2
About OOP concept → Write Program 3 or 4
Module 2
Substitute Programs from Given 12 Lab Programs
Theory Topic Asked You Can Substitute This Lab Program Why It Matches
Has overloaded distance()
Method Overloading Program 4 – MyPoint Class
methods
Uses parameterized
Constructor Program 3 – Employee Salary Raise
constructor
Parameterized
Program 3 – Employee Constructor with parameters
Constructor
Private variables + public
Encapsulation Program 4 – MyPoint
methods
Circle, Triangle, Square
Inheritance Program 5 – Polymorphism Demo
extend Shape
Runtime Polymorphism Program 5 – Polymorphism Demo Overriding draw() method
Abstract Class Program 6 – Abstract Demo Abstract class Shape
Interface Program 7 – Interface Demo Resizable interface
Inner Class Program 8 – InnerClassDemo Inner class inside Outer
Package Program 9 – PackageDemo Uses package and import
Exception Handling Program 10 – DivisionByZero try–catch–finally block
Custom Exception Program 10 – DivisionByZero User-defined exception class
Multithreading
Program 11 – RunnableThreadDemo Implements Runnable
(Runnable)
Multithreading (Thread
Program 12 – lab12 Extends Thread
class)
Arrays (2D) Program 1 – Matrix Addition Uses 2D array
Command Line Program 1 – Matrix Addition Uses args[0]
Theory Topic Asked You Can Substitute This Lab Program Why It Matches
Argument
Class & Object Program 2 – Stack Implementation Class with object creation
Object as Parameter Program 4 – MyPoint distance(MyPoint another)
❌ Not clearly present (needs separate
Returning Object
program)
Garbage Collection ❌ Not directly shown (theory only)
Recursion ❌ Not present in given 12
� Very Important Substitutions for Exam
If examiner asks → Write this lab program:
❌ Method Overloading → Program 4 (MyPoint)
❌ Constructor → Program 3 (Employee)
❌ Polymorphism → Program 5
❌ Abstract Class → Program 6
❌ Interface → Program 7
❌ Inner Class → Program 8
❌ Package → Program 9
❌ Exception Handling → Program 10
❌ Multithreading → Program 11 or 12
❌ Arrays → Program 1
❌ Stack (Data Structure) → Program 2
�Topics NOT Covered in Given 12 Programs
These require separate small programs:
Recursion
Fibonacci
Prime Number
Bitwise Operators
Ternary Operator
Shift Operators
Garbage Collection demo
Module 3
Substitute Programs for Each Question
Question Theory Topic Write This Lab Program Why Suitable
Shows Single &
1 Inheritance & Types Program 5 – Polymorphism Demo
Hierarchical inheritance
Program 5 – Polymorphism Demo Demonstrates method
2 super keyword
(modify with [Link]()) call from parent
draw() overridden in
3 Method Overriding Program 5 – Polymorphism Demo
subclasses
Constructor Order Need small separate
4 ❌ Not directly in 12
(Multilevel) example
Dynamic Method
5 Program 5 – Polymorphism Demo Shape s = new Circle();
Dispatch
Write small separate
6 final keyword ❌ Not in 12
example
7 Interface Program 7 – Interface Demo Resizable interface
Program 8 – Inner Class Demo Demonstrates inner
8 Nested Interface
(modify to inner interface) concept
Shape with draw()
9 Program 5 – Polymorphism Demo Same structure
& erase()
10 Resizable Interface Program 7 – Interface Demo Exact match
� MOST IMPORTANT SUBSTITUTIONS FOR EXAM
If examiner asks → Write this lab program:
� Inheritance → Program 5
� Method Overriding → Program 5
� Runtime Polymorphism → Program 5
� Dynamic Method Dispatch → Program 5
� Interface → Program 7
� Resizable Interface → Program 7
� Nested Interface → Program 8
� super keyword → Program 5 (small modification)
Topics NOT Covered in Given 12 Programs
You must write separate small programs for:
Constructor execution order (multilevel)
final keyword
Constructor chaining example
� Safe Strategy for External Exam
❌ If question is about Inheritance / Polymorphism / Dynamic Binding,
Always write Program 5 (Shape – Circle – Triangle – Square)
❌ If question is about Interface,
Always write Program 7 (Resizable Interface)
❌ If question is about Inner or Nested Concept,
Write Program 8 (Inner Class Demo)
Module 4
Substitute Programs (Packages & Exceptions Unit)
[Link] Topic Write This Lab Program Why Suitable
Visibility (private, default, Shows package + public
1 Program 9 – Package Demo
protected, public) access
Contains try–catch–
2 Multiple Catch Program 10 – DivisionByZero
finally
Access protection in Demonstrates public &
3 Program 9 – Package Demo
packages package use
4 Create & Import Package Program 9 – Package Demo Exact match
Program 10 – DivisionByZero
5 Chained Exception Custom exception
(modify with initCause())
6 Custom Exception Program 10 – DivisionByZero User-defined exception
Exception Handling try, catch, throw,
7 Program 10 – DivisionByZero
Mechanism throws
Built-in + Chained Arithmetic & custom
8 Program 10 – DivisionByZero
Exception handling
9 User-defined Package Program 9 – Package Demo Same structure
Write small separate
10 Nested if ❌ Not in 12
program
� Most Important Substitutions for Exam
If examiner asks → Write this lab program:
� Package creation / Import → Program 9
� Access Modifiers with Packages → Program 9
� Exception Handling → Program 10
� Custom Exception → Program 10
� Multiple Catch → Program 10
� throw / throws → Program 10
� Chained Exception → Program 10 (modify slightly)
Not Covered in Given 12
You must write separate small programs for:
Nested if statement
Pure built-in exception demo (like ArrayIndexOutOfBounds)
� Safe Exam Strategy
❌ For any question related to Exception,
Always write Program 10 (DivisionByZero Custom Exception)
❌ For any question related to Package,
Always write Program 9 (mypack + import demo)
Module 5
Substitute Programs (Threads Unit)
[Link] Topic Write This Lab Program Why Suitable
Thread class methods + Program 11 – RunnableThreadDemo OR Shows start(),
1
Multiple threads Program 12 – Thread Class Demo run(), sleep()
Write separate
2 Wrapper Classes ❌ Not in 12
small program
Program 12 – Thread Class Demo (add
3 isAlive() & join() Thread lifecycle
join() and isAlive())
Separate small
4 Autoboxing / Unboxing ❌ Not in 12
program
Runnable &
5 Ways of Creating Thread Program 11 & 12
Thread methods
Needs small new
6 Synchronization ❌ Not in 12
program
Program 12 – Thread Class Demo (add Uses Thread
7 Thread Priority
setPriority()) methods
Program 12 – Thread Class Demo (modify
8 4 Threads Sleep Demo Multiple threads
loop)
� Most Important Substitutions for Exam
If examiner asks → Write this lab program:
� Create Thread → Program 12 (Extends Thread)
� Runnable Interface → Program 11
� Multiple Threads → Program 11
� Thread Methods (start, sleep, run) → Program 12
� Thread Priority → Program 12 (modify)
� isAlive() / join() → Program 12 (modify)
Not Covered in Given 12 Programs
You must write separate programs for:
Wrapper Classes
Autoboxing / Unboxing
Synchronization (synchronized keyword)
� Safe Exam Strategy for Threads Unit
❌ If question says Create thread / Multiple thread / Thread methods,
Write Program 12 (Extending Thread)
❌ If question says Runnable interface,
Write Program 11
❌ If question says Thread life cycle / isAlive / join / priority,
Write Program 12 with small modification