Question: What is the output of the following Java programs? public class MyMethods{ public void sum(int a, int b) { System.out.printin(First method is called====>+a+++b+ = +(a+b));

What is the output of the following Java programs?

public class MyMethods{ public void sum(int a, int b) { System.out.printin("First method is called====>"+a+"+"+b+" = "+(a+b)); } public void sum(float a, float b)

{ System.out.printin("Second method is called ===> "+a+" + "+b+" = "+(a+b)):

}

public void sum(double a, double b) { System.out.printin("Third method is called ====>"+a+"+"+b+"="+(a+b));

}

} public class Main { public static void main (String] args){ MyMethods m= new MyMethods0; m.sum (1000, 4000); m.sum(10f, 400; m.sum(10d, 40d); System.out,printin(); m.sum(2000, -100): m.sum(5.5, -3.3); m.sum (5.5d, -3.3d); m.sum (5.5f,-3,3f); System.out.printin(); m.sum(6, 5.25); m.sum(6, 5.25f); m.sum(6, 5.25d);

}

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 Databases Questions!