package com.java1.day10;
public class MyMathTestEx02 {
public static void main(String[] args) {
MyMath mm = new MyMath();
long result1 = mm.add(5L, 3L);
long result2 = mm.subtract(5L, 3L);
long result3 = mm.multiply(5L, 3L);
double result4 = mm.divide(5L, 3L);
int result5 = mm.min(10, 5);
System.out.println("add(5L, 3L) = " + result1);
System.out.println("subtract(5L, 3L) = " + result2);
System.out.println("multiply(5L, 3L) = " + result3);
System.out.println("divide(5L, 3L) = " + result4);
System.out.println("min(10, 5) = " + result5);
}
}
class MyMath {
long add(long a, long b) {
long result = a+b;
return result;
}
long subtract(long a, long b) {
return a - b;
}
long multiply(long a, long b) {
return a * b;
}
double divide(double a, double b) {
return a / b;
}
int min(int a, int b) {
return a - b;
}
}
출력결과
add(5L, 3L) = 8
subtract(5L, 3L) = 2
multiply(5L, 3L) = 15
divide(5L, 3L) = 1.6666666666666667
min(10, 5) = 5