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

Home > Java Programming > Flow Control > Questions and Answers

Q: class A{
Public static void main(String args[]){
System.out.println(“ main method starts ”);
int i=10;
test();test(i);test(10);
}
Public static void test(int i){
System.out.println(i);
}
}
A. compile time error B. run time error
C. 10 D. no output

Answer and Explanation

Answer:compile time error

Explanation:
in the above code from main() method we are calling test() method without parameter but we don’t have test() method signature like without parameter, so compiler is unable to recognize test() method so it will throw an error.

Comment on this Question

Name:

Loading...




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