• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SCJP Chapter 01 Self Test Qn no. 3

 
kiruthigha rajan
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic