Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Doubt regarding overloaded method example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Doubt regarding overloaded method example" Watch "Doubt regarding overloaded method example" New topic
Author

Doubt regarding overloaded method example

Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Hi

Following is an assignment question in SCJP for java 5 book:


The answer is -434

Can someone explain how ? In what order are the methods called and why?


~ Mansukh
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
Start by writing down very carefully what the four methods are, and what their parameters are (ie their signatures)..
Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Campbell Ritchie wrote:Start by writing down very carefully what the four methods are, and what their parameters are (ie their signatures)..


Got it sir. Arrays are objects too. hence the -434. Was a tricky one though..
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
Yes, an array is an object. The Foo[]... versions are equivalent to Foo[][] and you don’t have any arrays of arrays in that code.
Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Campbell Ritchie wrote:Yes, an array is an object. The Foo[]... versions are equivalent to Foo[][] and you don’t have any arrays of arrays in that code.


As borat says, HIGH 5!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
Thank you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt regarding overloaded method example
 
Similar Threads
Self Test doubt
Var Args,Arrays and overloading
Program Output
Study Guide 6 -- Chapter2 Self Test Question 15 on page 181.
SCJP 1.6 Chapter2 Question 15- Answer -> is D ,I think it should be E