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

Static void test(byte… b){
System.out.println(“byte-varargs”);
}


Public static void main(String args[]){
byte s=10;
test(s);
}
}
A. compile time error

B. byte-varargs
C. int D. byte

Answer and Explanation

Answer:byte

Explanation:
From main() we are calling test(s) by passing only one parameter , first it will check do we have test(byte b) with one parameter , if there is no test() with one parameter then it will call test(byte …b), if only one argument is there then it will call that method only.

Comment on this Question

Name:

Loading...




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