adplus-dvertising
frame-decoration

Question

In the below code, which call to sum() method is appropriate?
class Output 
{
 
        public static int sum(int ...x)
        {
             return; 
        }
        static void main(String args[]) 
        {    
             sum(10);
             sum(10,20);
             sum(10,20,30);
             sum(10,20,30,40);
        } 
}

a.

only sum(10)

b.

only sum(10,20)

c.

only sum(10) & sum(10,20)

d.

all of the mentioned

Posted under Java Programming

Answer: (d).all of the mentioned

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. In the below code, which call to sum() method is appropriate?