what is abstract class ?
🔹 Definition:
An abstract class in Java is a class that cannot be instantiated (cannot create an
object of that class directly)
and may contain abstract methods (methods without a body) as well as concrete
methods (methods with a body).
To use an abstract class you have to inherite it from sub class (abstarct class
must be super class)
syntax : abrtact className{ }
what is abstract method ?
🔹 Definition:
An abstract method is a method without a body . It is declared using the abstract
keyword inside an abstract class or an interface.
🔹 Key Features of an Abstract Method
Declared but not implemented in the abstract class.
Must be overridden in a subclass.
Ends with a semicolon (;) instead of a method body { }.
Forces subclasses to provide their own implementation.
Use an abstract method when:
✅ You want to enforce a common method across all subclasses but with different
implementations.
✅ You don't know the exact implementation yet, but you want to define the method
structure.