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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started