Welcome Guest | Sign in | Register
Flow Control - Discussion Page For Q.2793 | 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[]){
int I=10;
test(i)
System.out.println(i);
}
Public static int test(int i){

System.out.println(i);
}
}
A. compile time error B. run time error
C. 10 10 D. 10

Answer and Explanation

Answer:10 10

Explanation:
here the code which we have in main method will execute, and test() method we are calling from main by passing I value so test() method will execute and display the I value . To call test() method no need to create an object because test() method is declared as static ,so memory will be allocated automatically. You can call directly.

Comment on this Question

Name:

Loading...




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