Question: Given the following code, which statement is correct? class Sample { int add ( int x , int y ) { return x + y;

Given the following code, which statement is correct?
class Sample { int add(int x, int y){ return x+y;}// form 1 String add(String x, String y){ return (x+y)+""; }// form 2 double add(int x, int y, int z){ return x+y+z; }// form 3 void add(int x){ System.out.print(x); }// form 4}
Group of answer choices
form 1 has a conflict with form 2 because parameters in form 2 are different from parameters in form 1.
form 1 has a conflict with form 3 because the number of parameters in form 3 is not equal to that of form 1.
There is no conflict among these four forms.
form 2 is the one that will cause conflicts with others because String is not a primitive data type.
form 4 is the one that will cause conflicts because it is the void type.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!