• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.
 
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
The WEB SERVICES and JAX-RS Course
https://coderanch.com/t/690789/WEB-SERVICES-JAX-RS
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!