KTU OOP Java2024 Scheme • 60M ESE
Module 210 Theory Topics3 Official Diagrams

Polymorphism & Inheritance

Master compile-time and runtime polymorphism: method overloading, passing and returning objects, recursive stack tracing, static & final members, inner classes, inheritance types, super, constructor chaining order, method overriding, and dynamic method dispatch.

Exam Focus: High-yield areas: Overloading vs Overriding, Call-by-value of object references, recursion stack trace, constructor calling order (Box -> BoxWeight -> Shipment), super, dynamic method dispatch diagram, and final with inheritance.

Section 1: Polymorphism

01

Polymorphism & Method Overloading (Compile-Time Binding & Resolution Rules)

In C, computing the absolute value of an int, long, and double required memorizing three distinct function names (abs(), labs(), fabs()). Java eliminates that clutter through Polymorphism ('many forms'), starting with Compile-Time Method Overloading—letting one clean method name (Math.abs() or area()) handle multiple parameter combinations intelligently.

15m•HIGH PRIORITY
02

Objects as Parameters, Returning Objects & Java Argument Passing Semantics

Methods don't just exchange int or double values—they routinely accept whole objects as parameters (for example, comparing two objects or constructing a clone) and manufacture new objects as return values. Understanding what happens to object references when passed into a method is essential for code-tracing questions!

14m•HIGH PRIORITY
03

Recursion in Java: Base Case, JVM Stack Tracing & Unwinding

Recursion is a powerful problem-solving technique where a method breaks a problem into smaller identical subproblems by calling itself. In KTU exams, you are frequently asked to define recursion, explain what happens inside the JVM Stack during recursive calls, and trace outputs for Factorial, Fibonacci, or reverse-printing routines.

14m•HIGH PRIORITY
04

Static Members (Variables, Methods, Blocks) & Final Variables

Most variables and methods belong to individual objects (s1.name, s2.name). But sometimes a property—like a shared college name, a total object counter, or mathematical PI—belongs to the entire class or must never change. Java handles class-level sharing with static and immutability of constants with final.

14m•HIGH PRIORITY
05

Inner Classes in Java: Types, Access Rules & Syntax

Sometimes one helper class only makes logical sense inside another class—for example, a button click listener tied tightly to one window, or an internal iterator belonging to a data structure. Java allows nesting a class inside another class (Nested / Inner Classes), giving it privileged access even to the outer class's private members!

14m•MEDIUM PRIORITY

Section 2: Inheritance

01

Inheritance Fundamentals, `extends` & Types of Inheritance (incl. Multiple/Hybrid Limitations)

Why rewrite name, age, and displayBasicInfo() separately inside Student, Teacher, and Doctor? Inheritance lets you place shared traits in a general Superclass (Person) and create specialized Subclasses (Student extends Person) that automatically inherit those members and add only what is unique—creating clean hierarchical classifications.

16m•HIGH PRIORITY• Includes Diagram
02

The `super` Keyword & `protected` Members in Inheritance

When a superclass keeps its fields private (for encapsulation) or when a subclass declares a field/method with the same name as its parent, how can the subclass initialize those hidden parent variables or invoke the parent's version? Java provides the **super keyword—plus the protected modifier** when you intentionally want subclasses across packages to inherit controlled access.

13m•HIGH PRIORITY
03

Constructor Calling Order & Execution in Multilevel Inheritance

When you create an object of a subclass at the bottom of a multilevel chain (like Shipment extends BoxWeight extends Box), multiple constructors run—one for every class in the hierarchy! Knowing the exact order in which those constructors are invoked vs completed is one of the highest-yield tracing topics in Module 2.

14m•HIGH PRIORITY• Includes Diagram
04

Method Overriding, Dynamic Method Dispatch (Runtime Polymorphism) & Overloading vs Overriding

Dynamic Method Dispatch—powered by Method Overriding—is the crown jewel of Object-Oriented Programming in Java. It allows you to write general algorithms against a single superclass (Figure or Shape) while subclasses (Rectangle, Triangle) supply specialized implementations selected automatically at runtime!

18m•HIGH PRIORITY• Includes Diagram
05

Using `final` with Inheritance: `final` Methods, `final` Classes & Performance

Inheritance is powerful, but sometimes an architect intentionally locks a method's security check or locks an entire class (like java.lang.String) so nobody can create malicious or buggy subclasses. The **final keyword** gives you that exact lock at three levels: constants, methods, and classes.

11m•MEDIUM PRIORITY