• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to divide class that contains Thread?

Shay Gaghe
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends!
I�m developing a chat program. in the first place I used only one class to implement the program in each side but now since I have implemented many futears and I don�t use debug I find it almost impossible to menually debug the program cuz its getting too long. So I desided to divide the main class to logical parts (as classes).
the problem is like that ; since i need the client to use Thread and since i dont like to use Runnable interface i put within the main class another class that extends Thread and override run() , after the login request i create this class to listen to server's streams:

like i said i want to divid that main class. the problem is that im not sure how i need to handle the Thread if i divides "WaitThread" into a public class, can i do " new WaitThread(input)" to a class that is out of the main class(public class) and still get the input from the server?, if so how??
hope its understandable
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic