Varargs (Variable-length arguments), as the name suggests, is a concept that allows a method to receive a variable number of arguments. When you use the varargs method, you do not need to overload a method, for example: int add (int ... n){}, this add method can be called by passing any number of integer values. Although it may seem that overloading is not required, in some cases where you want to overload a method with different data type arguments, overloading is the way to go.
In which version of Java Varargs concept was introduced?
a) Version 4
b) Version 5
c) Version 7
d) Version 9
Created by Nancy N.
@12:44 3-=May-2025
No comments:
Post a Comment