Question: 8. What will be the output of the following Java program?<div class="hk1_style-wrap4"><div class="hk1_style-wrap3"><div class="hk1_style-wrap2"><div class="hk1_style-wrap"><div class="hk1_style"><div class="java"><ol><li class="li1"><pre class="de1"> <span class="kw1">class</span> newthread <span class="kw1">extends</span> <span class="kw3">Thread</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> <span class="kw3">Thread</span> t<span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> <span class="kw3">String</span> name<span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> newthread<span class="br0">(</span><span class="kw3">String</span> threadname<span class="br0">)</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> name <span class="sy0">=</span> threadname<span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> t <span class="sy0">=</span> <span class="kw1">new</span> <span class="kw3">Thread</span><span class="br0">(</span><span class="kw1">this</span>,name<span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> t.<span class="me1">start</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li><li class="li1"><pre class="de1"> <span class="kw1">public</span> <span class="kw4">void</span> run<span class="br0">(</span><span class="br0">)</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li><li class="li1"><pre class="de1"> <span class="kw1">class</span> multithreaded_programing</pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> <span class="kw1">public</span> <span class="kw1">static</span> <span class="kw4">void</span> main<span class="br0">(</span><span class="kw3">String</span> args<span class="br0">[</span><span class="br0">]</span><span class="br0">)</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> newthread obj1 <span class="sy0">=</span> <span class="kw1">new</span> newthread<span class="br0">(</span><span class="st0">"one"</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> newthread obj2 <span class="sy0">=</span> <span class="kw1">new</span> newthread<span class="br0">(</span><span class="st0">"two"</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> <span class="kw1">try</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> <span class="kw3">Thread</span>.<span class="me1">sleep</span><span class="br0">(</span><span class="nu0">1000</span><span class="br0">)</span><span class="sy0">;</span> </pre></li><li class="li1"><pre class="de1"> <span class="kw3">System</span>.<span class="me1">out</span>.<span class="me1">print</span><span class="br0">(</span>obj1.<span class="me1">t</span>.<span class="me1">isAlive</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li><li class="li1"><pre class="de1"> <span class="kw1">catch</span><span class="br0">(</span><span class="kw3">InterruptedException</span> e<span class="br0">)</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> <span class="kw3">System</span>.<span class="me1">out</span>.<span class="me1">print</span><span class="br0">(</span><span class="st0">"Main thread interrupted"</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li></ol></div></div></div></div></div></div>
Options:
true
false
Main thread interrupted
None of the mentioned
Answer: B