E Kirskon

Greenhorn
+ Follow
since May 29, 2015
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by E Kirskon

Hello all. I am relatively new to java and programming in general. It's my first post in the forum and I hope my question is not too big.

I have the code for a server/client app which is supposed to work with two users. I am aware of the basic concepts for threads, constuctors, etc, but I can seem to put it all together and understand how it works exactly.

First, in the constructor here two threads are created and started. I am not sure what exactly should the "this" should represent in this case :

thrOne = new Thread(this);


Is it the construcotr passing itself to the newly created thread? If, yes how does it work? Is there another way?
Second thing is the case with the two threads used in this Server class. I guess, that threads are two since the users are supposed to be two as well. But is it a good idea to be done like that? And how does the server assign the different threads to different users. I am lost.

Sorry again if my question is too big.
Best regards.


9 years ago