Question: Given the following code, which form of the add method can generate 3 . 2 4 . 1 as output? class Sample { int add

Given the following code, which form of the "add" method can generate 3.24.1 as output?
class Sample { int add(int x, int y){ return (x + y); }//form1 float add(float x, float y){ return (x + y); }//form2 double add(double x, double y){ return (x + y); }//form3 char add(char x, char y){ return (char)((int) x +(int) y); }//form4 String add(String x, String y){ return (x + y); }//form5..........}
Group of answer choices
form 4
form 3
form 1
form 5
form 2

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!