O'Reilly logo

Spring Recipes: A Problem-Solution Approach, Third Edition by Daniel Rubio, Gary Mak, Josh Long, Marten Deinum

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required