Explain var args in java with example

Tutorials Shared by the Internet Community


  Top Tutorials     New Tutorials     Submit     Login     Register  

Explain var args in java with example

This tutorial explains what is var args and how to use varargs method in java?
  • Total Hits: 9677

  • Average Rating :
    URL RatingURL RatingURL RatingURL RatingURL Rating


  • Total Votes: 15 votes

  • Category: JAVA/Core JAVA

  • Submitted on: 2014-07-15 05:47:55

  • Submitted By: jessie

  • Set as Favorite


varargs introduced in java from 1.5 which allows methods arguments to accept variable number of arguments.Before varargs were introduced variable number of arguments are handled as follows:

1) use variable versions of method    More detail...

Rating Detail

 Stars  Percentage  Total Vote
 One star  Vote LeftVote MiddleVote Right 26.67%  4
 Two starsTwo star  Vote LeftVote MiddleVote Right 13.33%  2
 Three starsThree starsThree stars  Vote LeftVote MiddleVote Right 13.33%  2
 Four starsFour starsFour starsFour stars  Vote LeftVote MiddleVote Right 26.67%  4
 Five starsFive starsFive starsFive starsFive stars  Vote LeftVote MiddleVote Right 20%  3

Caste Your Vote

 Rating  Selection  Guidelines
 Poor:     Very disappointing, useless.
 Fair:     Below average, disappointing but not useless.
 Good:     About average in its class.
 Very Good:     Above average for its category.
 Excellent:     One of the best Tutorials in its category.