Welcome Guest | Sign in | Register
Objects and Collections - Discussion Page For Q.2916 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Objects and Collections > Questions and Answers

Exercise:

Section 1

Q: class W{
Static void method(Byte I,Byte I ){
System.out.println(“BByte”); }
Static void method(byte…b){
System.out.println(“byte”); }

Public static void main(String args[]){
byte i=10;
method(i,i); }
}
A. compile time error B. runtime error
C. int D. byte

Answer and Explanation

Answer:compile time error

Explanation:
while calling method() from main() we are passing exactly two parameter as byte , as we are calling by passing only byte that to as primitive type but in a arguments both variable name is same that is I.. so it will throw compile time error.

Comment on this Question

Name:

Loading...




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