Welcome Guest | Sign in | Register
Objects and Collections - Discussion Page For Q.2912 | 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{
Public static void main(String args[]){
Int i=10;
Method(i); }
Static void method(Object o){
System.out.println(“object”); }
Static void method(Number n){
System.out.println(“number”); }
}
A. compile time error B. runtime error
C. object D. number

Answer and Explanation

Answer:number

Explanation:
from main() method calling Method by passing 10 as parameter. For int values Number is a super class , so output is option d).. Object is a super class of all the different type of class not for primitives.

Comment on this Question

Name:

Loading...




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