0
Creating Thread by implementing Runnable interface
I have read that creating threads by implementing the runnable interface is a preferred approach since it allows us to extend classes as well. My question is, won't we have to define every method in the interface first before we get going with our class? If so, won't it be an unnecessary hassle?
1 Respuesta
+ 2
yes but there is only one method in the runnable interface, "run()" so it wont be a hassle the important thing is that your class becomes a runnable object and can be used by other classes that call the runnable objects, mainly thread