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(); }} An exception is thrown at runtime. Compilation fails. "go" is printed "gogo" is printed "gogogo" is printed An exception is thrown at runtime. Compilation fails. "go" is printed "gogo" is printed "gogogo" is printed 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"); }} "BeginEndRun" is printed. "BeginEnd" is printed. "BeginRunEnd" is printed. Compilation fails. An exception is thrown at runtime. "BeginEndRun" is printed. "BeginEnd" is printed. "BeginRunEnd" is printed. Compilation fails. An exception is thrown at runtime. ANSWER DOWNLOAD EXAMIANS APP