File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Android Security Essentials Live Lessons this week in the Android 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..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: SCJP Chapter 01 Self Test Qn no. 3
 
Similar Threads
var-args doubt clarification needed
New type of var-args syntax (at least to me)
Gotcha: Varargs spoofs method signature [from Sierra/Bates book]
varargs doubt
DOUBT from scjp book