Welcome Guest | Sign in | Register
Final and Datatypes - Discussion Page For Q.2745 | 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 void test(int I,int j){
System.out.println(“integer”);
}
Static void test(byte …b){
System.out.println(“byte”);
}

Public static void main(String args[]){
byte s=10;
test(s,s);
}
}

A. compile time error B. runtime error
C. byte D. 0

Answer and Explanation

Answer:byte

Explanation:
Byte…b is called var-args(variable arguments).from main() when we call test(s,s) then test(byte…b) will execute.. to call test(byte…b) you can pass any number of parameters, but it should be of type byte as per the above example.

Comment on this Question

Name:

Loading...




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