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

Home > Java Programming > Final and Datatypes > Questions and Answers

Q: Class F
{
Static long test(int i){
Return I;
}
Public static void main(String args[]){
Short s=10;
Double d2=test(s);
System.out.println(d2);
}
}
A. compile time error B. runtime error
C. 10.0 D. 0

Answer and Explanation

Answer:10.0

Explanation:
from main() we are calling test() by passing 10, but it returns of type long , that long value can be stored in double variable d2, so output is 10.0

Comment on this Question

Name:

Loading...




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