• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

varargs doubt

 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is a self test question from pg-79 of K&B book

question is :


given choice for answer :


the answer given is A & E.

i think the answer should be only E because each method has argument " 1" so 1st argument is fixed . morever option A takes a number of arguments but option E takes the first argument that is same in both methods { i.e 1 } & then any number of arguments.

am i misinterpreting something or is it right ? if right explain
 
Vijitha Kumara
Bartender
Pie
Posts: 3918
10
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Varargs accepts zero(0) or more number of arguments (0,1,2 etc...). Now can you understand the reasoning for the given answer?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic