Var- arg methods (variable no of argument methods) (1.5)

• Until 1.4v we can’t declared a method with variable no. Of arguments. If there is a change in no of arguments compulsory we have to define a new method. This approach increases length of the code and reduces readability. But from 1.5 version onwards we can declare a method with vafiable no. Of arguments such type of methods are called var-arg methods.
• We can declare a var-arg method as follows.
methodOne(int… x)


•We can call or invoke this method by passing any no. Of int values including zero number.


Leave a comment

Design a site like this with WordPress.com
Get started