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

Home > Java Programming > Inner Classes > Questions and Answers

Q: Is the bellow code compile without error?
public class ThreadTest {
Runnable r = new Runnable() {
public void run() { }
};
}
A. compile without error B. compile with error because Runnable is an Interface.
C. Compilation succeed but Runtime Exception D. None of the above

Answer and Explanation

Answer:compile without error

Explanation:
instantiating an implementer of the Runnable interface (an anonymous
implementation class). So compile without error.

Comment on this Question

Name:

Loading...




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