Good day all, for running multiple threads concurrently is it advisable to create different thread objects from a class or create two classes where one implements runnable and one extends a thread and then create thread objects from both of them as needed assuming we are trying to run 7- 10 tasks concurrently.
- whats are the best solutions?..
- Are there any pitfalls or performance hit, if one creates different thread objects from a single class?.
Thank you. Tips appreciated as always.
I would personally go for option(1) (Creating 2 different threads of the same class).
I don’t feel there’s need to create 2 different classes for the job that can be done by 2 different threads of the same class.