Welcome Guest | Sign in | Register
Threads - Discussion Page For Q.2947 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Threads > Questions and Answers

Q: public class Threads5 {

public static void main (String[] args) {
new Thread(new Runnable() {
public void run() {
System.out.print("bar");
}}).start();
}
}

What is the result?
A. Compilation fails. B. An exception is thrown at runtime.
C. The code executes normally and prints "bar". D. The code executes normally, but nothing prints.

Answer and Explanation

Answer:The code executes normally and prints "bar".

Explanation:
just a normal flow of execution.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.