• Post Reply Bookmark Topic Watch Topic
  • New Topic

What does this mean?

 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When we write the following line of code for example, what does it mean?

class Worker extends Thread
{

}

Thanks.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

It means that you declare a new class called "Worker" that extends the existing class "Thread". Threads are used for concurrent execution of code, but since the "run" method of thread is not overridden, the Worker class is not going to do anything useful.

Note that it's much better to implement Runnable than to extend Thread: ExtendingThreadVsImplementingRunnable
 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much.
[ May 22, 2008: Message edited by: Abder-Rahman Ali ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!