November 2014
Intermediate to advanced
808 pages
22h 47m
English
package com.apress.springrecipes.calculator;public class MaxCalculatorImpl implements MaxCalculator { public double max(double a, double b) { double result = (a >=b) ? a : b; System.out.println("max(" + a + ", " + b + ") = " + result); return result; }}package com.apress.springrecipes.calculator;public class MinCalculatorImpl implements MinCalculator { public double min(double a, double b) { double result = (a <= b) ? a : b; System.out.println("min(" + a + ", " + b + ") = " + result); return result; }}
Now, suppose you would like ArithmeticCalculatorImpl to perform the max() and min() calculation also. As the Java language supports single inheritance only, it is not possible for the ArithmeticCalculatorImpl ...