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

Win a copy of Android Security Essentials Live Lessons this week in the Android 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

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: 41132
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

Joined: Aug 05, 2005
Posts: 3431
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
Similar Threads
Client disconnected from server after about 10 minutes of inactivity
Annotation for VerySimpleChatServer from Head First Java book
ServerSocket to SSL
85 line program...wondering if it's possible to do in Applets
What type should i cast?