double divide(double x, double y) {
return x / y;
}
public static void main(String[] args) {
Hello hello = new Hello();
double result2 = hello.divide(30, 4);
System.out.println(result2);
double divide(int x, int y) {
return (double)x / (double)y;
}
public static void main(String[] args) {
Hello hello = new Hello();
double result2 = hello.divide(30, 4);
System.out.println(result2);
}
7.5
코드에 차이점이 있지만 둘다 divide 나눗셈 몫의 출력값은 double타입으로 동일하다.