Q5. When compared with C++ what is the advantage in java with respect to Multithreading?
Ans.Java language provides inbuilt support for multithreading by defining a reach library, classes and interfaces like Thread, ThreadGroup, Runnable etc. But in c++ there is no inbuilt support for multithreading.
Q6. In how many ways we can define a Thread? Among extending Thread and implementing Runnable which is recommended?
Ans. We can define a Thread in the following two ways:

  1.  by extending Thread class or
  2.  by implementing Runnable interface.

Among the two ways of defining a thread implementing Runnable mechanism is always recommended. In the first approach as our Thread class already extending Thread there is no chance of extending any other. Hence, we missing the key benefit of oops(inheritance properties).

Q7.  What is the difference between t.start() and t.run() method?

Ans.       In the case of t.start() method, a new thread will be created which is responsible for the execution of run() method.
                But in the case of t.run() method no new thread will be created main thread executes run() method just like a normal method call.   

Q8.         Explain about Thread Scheduler?

Ans.    If multiple threads are waiting for getting the chance for executing then which thread will get chance first decided by Thread Scheduler. It is the part of JVM and its behavior is vendor dependent and we can’t expect exact output.Whenever the situation comes to multithreading the guarantee behavior is very- very low.