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 ...
Get Spring Recipes: A Problem-Solution Approach, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.