This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Help with this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with this "ready-bake code", implementing Runnable" Watch "Help with this "ready-bake code", implementing Runnable" New topic
Author

Help with this "ready-bake code", implementing Runnable

Tarek Khojah
Ranch Hand

Joined: Jul 21, 2007
Posts: 58


The "ClientHandler" class implements Runnable, but when I create the thread (Thread t = new Thread(new ClientHandler(clientSocket)) I get an error saying there is no such constructor for ClientHandler, I looked into the API and it had nothing on Runnable's constructor(s).

Help please.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41591
    
  55
public class ClientHandler

public void clientHandler (Socket clientSocket)

Capitalization matters in Java. The second line of code is currently not a constructor for the class.


Ping & DNS - my free Android networking tools app
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3477
    
  13
And if you do want it to be a constructor, you will need to get rid of the 'void', otherwise it will just be a method with the same name as the class.


Joanne
 
jQuery in Action, 2nd edition
 
subject: Help with this "ready-bake code", implementing Runnable