5. Given the following code, which form of the "add" method will be called for execution?
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
boolean add(boolean x, boolean y) { return x; } //form4
public static void main(String[] args)
{
Sample s1 = new Sample();
System.out.print(s1.add(3.2, 4.1));
}
}
A. form 1
B. form 2
C. form 3
D. form 4
E. None of the options
C. form 3
Comments
Leave a comment