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

Home > Java Programming > Interface > Questions and Answers

Q: interface A{
public void test(){
System.out.println(1);
}
}
A. 1 B. compile time error
C. runtime error D. none of the above

Answer and Explanation

Answer:compile time error

Explanation:
In an interface all methods are by default public abstract , so interface methods should not have body , here in the example test() method has body so it will throw compile time error.

Comment on this Question

Name:

Loading...




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