wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes SCJP Chapter 01 Self Test Qn no. 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "SCJP Chapter 01 Self Test Qn no. 3" Watch "SCJP Chapter 01 Self Test Qn no. 3" New topic
Author

SCJP Chapter 01 Self Test Qn no. 3

kiruthigha rajan
Ranch Hand

Joined: Dec 29, 2011
Posts: 69

Answer:
-> A and E use valid var-args syntax.
My Doubt Is Why "Option B" Is Wrong ??
thanks in advance
Md. Minhajur Rahman
Ranch Hand

Joined: Apr 10, 2012
Posts: 33
Hello rajan,
Option B is not correct. Because If you use it, then at line 3 and 4 will cause compilor error as it couldn't find match. Because doStuff(1) expect a function that takes an integer argument not an integer array argument (except var-args). Same reason for doStuff(1,2).
kiruthigha rajan
Ranch Hand

Joined: Dec 29, 2011
Posts: 69
Md. Minhajur Rahman wrote:Hello rajan,
Option B is not correct. Because If you use it, then at line 3 and 4 will cause compilor error as it couldn't find match. Because doStuff(1) expect a function that takes an integer argument not an integer array argument (except var-args). Same reason for doStuff(1,2).


now its clear..thanks alot sir..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SCJP Chapter 01 Self Test Qn no. 3
 
Similar Threads
varargs doubt
Gotcha: Varargs spoofs method signature [from Sierra/Bates book]
DOUBT from scjp book
var-args doubt clarification needed
New type of var-args syntax (at least to me)