Java: Signatures and Method HELP
I need help with this Java code!
I want to count the numbers in the main using the code in the class MyMath. But I dont really understand how? This is what I have done so far but it's not correctly performed and it doesnt count the last line from the main:
THE CODE:
Thanks for any help in advance!
I need help with this Java code!
I want to count the numbers in the main using the code in the class MyMath. But I dont really understand how? This is what I have done so far but it's not correctly performed and it doesnt count the last line from the main:
Code:
System.out.println(MyMath.add(123, 6.54));
THE CODE:
Code:
package your_username;
public class Program
{
public static void main(String[] args)
{
int intSum = MyMath.add(123, 456);
System.out.println(intSum);
double doubleSum = MyMath.add(9.87, 6.54);
System.out.println(doubleSum);
System.out.println(MyMath.add(123, 6.54));
}
}
class MyMath
{
public static int add(int i, int j) {
System.out.println(">>> metoden med signaturen add(int, int) har anropats <<<");
return (123+456); //
}
public static double add(double d, double e) {
System.out.println(">>> metoden med signaturen add(double, double) har anropats <<<");
return (9.87+6.54);
}
}
Thanks for any help in advance!








