JAVA Threads When a class extends the Thread class ,it should override ............ method of Thread class to start that thread. init() start() go() run() init() start() go() run() ANSWER DOWNLOAD EXAMIANS APP
JAVA Threads Given the code. What will be the result?public class Test implements Runnable{ public static void main(String[] args) throws InterruptedException{ Thread a = new Thread(new Test()); a.start(); System.out.print("Begin"); a.join(); System.out.print("End"); } public void run(){ System.out.print("Run"); }} "BeginRunEnd" is printed. An exception is thrown at runtime. Compilation fails. "BeginEndRun" is printed. "BeginEnd" is printed. "BeginRunEnd" is printed. An exception is thrown at runtime. Compilation fails. "BeginEndRun" is printed. "BeginEnd" is printed. ANSWER DOWNLOAD EXAMIANS APP
JAVA Threads What will be the output after compiling and executing the following code?public class Test implements Runnable{ public static void main(String[] args) throws InterruptedException{ Thread a = new Thread(new Test()); a.start(); System.out.print("Begin"); a.join(); System.out.print("End"); } public void run(){ System.out.print("Run"); }} "BeginEnd" is printed. "BeginRunEnd" is printed. "BeginEndRun" is printed. An exception is thrown at runtime. Compilation fails. "BeginEnd" is printed. "BeginRunEnd" is printed. "BeginEndRun" is printed. An exception is thrown at runtime. Compilation fails. ANSWER DOWNLOAD EXAMIANS APP
JAVA Threads What will be the output?class One extends Thread{public void run(){for(int i=0; i<2; i++){System.out.print(i);}}}public class Test{public static void main(String args[]){Test t = new Test();t.call(new One());} public void call(One o){o.start();}} Compilation Error 0 1 0 0 None of these Compilation Error 0 1 0 0 None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Threads In java a thread can be created by .......... None of these Implementing Runnable interface. Extending the thread class. Both of the above None of these Implementing Runnable interface. Extending the thread class. Both of the above ANSWER DOWNLOAD EXAMIANS APP
JAVA Threads What will be output of the following program code?public class Test implements Runnable{ public void run(){ System.out.print("go"); } public static void main(String arg[]) { Thread t = new Thread(new Test()); t.run(); t.run(); t.start(); }} "gogogo" is printed "go" is printed An exception is thrown at runtime. "gogo" is printed Compilation fails. "gogogo" is printed "go" is printed An exception is thrown at runtime. "gogo" is printed Compilation fails. ANSWER DOWNLOAD EXAMIANS APP