java - How to run threads without using Runnable implementations? -
i found following excerpt in java textbook:
"i've seen examples don't use separate runnable implementation, instead make subclass of thread , override thread's runo method. way,you call thread's no-arg constructor when make new thread; thread t = new thread(); //no runnable"
shouldn't last line be
thread t = new <some class extends thread class , on rides run method>();
am correct?
could provide sample code illustrates above excerpt?
you correct.
if create instance of thread
without overriding run()
of supplying runnable
, thread execute default empty run()
method.
i wonder if quote accurate, mentions sub-classing thread, code thread t = new thread();
doesn't.
Comments
Post a Comment