6. Given the following code, which form of the "add" method can generate 3.24.1 as output? Please select "A, B, C, D, or E" as correct option.Â
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
..........
}
A. form 1
B. form 2
C. form 3
D. form 4
E. form 5
Answer : B,C
Comments
Leave a comment