Category: OOP

What is Factory Method?
Natan Ferreira
- 0
- 168
The Factory Method is a creational design pattern that provides an interface for creating objects in a superclass but allows subclasses to alter the type of objects that will be created. In addition to the use of polymorphism, it is possible to create either ProductA or ProductB, depending on which factory is being used. The…
Read More
Why use Abstract Classes in Java?
Natan Ferreira
- 0
- 137
Abstract classes in Java are templates that cannot be instantiated directly and may include abstract methods (without implementation) and concrete methods (with implementation). They are used to define common behaviors that subclasses must implement while sharing reusable code. Abstract methods act as placeholders, enforcing a contract that subclasses must fulfill. Let’s look at an example.…
Read More