The super(String)
statement is an explicit super class constructor call.
All java constructors must call one or another constructor from their super classes. By default the no-args constructor is invoked, but in this way you can explicitly specify which super class constructor to invoke.
The Thread
class constructor that takes a String
argument creates a Thread
with a specific name (as opposed to automatically generated names such as Thread-1).
The easiest way for you to determine what the complete program does is to actually execute it.
When the start()
method of a Thread
instance is called the thread begins to execute (the run()
method eventually gets called). As you can see, in this case, the run()
method of CustomThread1
class simply calls the show(String, int)
method of its Shared
instance, which prints whatever it is passed into the console.