File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

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

Joined: Mar 22, 2005
Posts: 42965
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.
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
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.

I agree. Here's the link:
subject: Help with this "ready-bake code", implementing Runnable
It's not a secret anymore!