Approach 1: Static methods
- The logger has a static method
- Classes that use the logger call the static method
public class ImportantProcessHandler {
public static void handleImportantProcess() {
// Do something...
Logger.log("Done!");
}
}
public class Logger {
public static void log(String message) {
System.out.println(message)
}
}
22 / 27