Q1 :- How does Java maintains a record of threads waiting on an object? Ans :- Each object has a waiting set. Every time a thread calls wait on an object, that thread gets added in that waiting-set. So, a Set datastructure is used to maintain the record of waiting threads in java. Q2 :- What is the difference […]
Implement runnable interface using a class in java.
Runnable is a Functional Interface. It has one abstract method called run. To make use of this class, we need to provide an implementation for this method. In practice, compiler only needs a non-abstract method. You can provide a empty body and that will be enough. The implementation need not be meaningful. Here is a simple class, […]