run()
method, such as having a class that implements the Runnable , implement the run()
method and pass the reference of an object of this class that we created as an argument to the Thread constructor.
Looking at the code of the start()
method, it makes a call to the run()
method that could be interpreted, in my opinion, as a step for the execution of the start()
method of Thread .
Would it be possible to apply the template method using composition?
Could the class Thread of the java.lang
package be seen as a good example of this pattern using composition?
Given the definition of pattern :
Defines the skeleton of an algorithm in an operation, letting subclasses complete some of the steps.
Would it be possible to state what was stated above?