Interface vs AbstractClass
• Abstract Class: Can have state.
• Interface: Only constants and abstract
methods.
• Interfaces allow multiple inheritance.
7.
Case Study: ShapeClass
• abstract class Shape { abstract void area(); }
• Rectangle, Circle extend Shape and implement
area().
8.
Java Keywords inOOP
• this: Refers to current object.
• super: Refers to parent class.
• final: Prevents override.
• static: Shared across instances.
9.
Best Practices inOOP
• Use private fields and public methods.
• Prefer composition over inheritance.
• Avoid repetition (DRY principle).
10.
Summary and Activity
•Create abstract class Employee.
• Subclasses: Manager, Developer.
• Override displayDetails().