July 19, 2023

Static Factory Methods in Java

The traditional method used to create an object from a class is by providing a public constructor. However, besides this method, there is another technique that programmers should be aware of. You can write a public static factory method for a class. This method simply returns an instance of that class. One example of this […]