April 2019
Intermediate to advanced
360 pages
9h 17m
English
Our implementation starts with a Mower interface. It has a single mow() method:
public interface Mower { void mow();}
The following segment of code is the MowerFactor abstract class. There, we will have the ConcreteMowerFactory subclass:
abstract class MowerFactory { public abstract Mower getMowerType(String mowerType);}
The Riding class represents the class object for this type of mower. It implements the Mower interface. It overrides the mow() method and outputs text that's specific to this type of Mower:
public class Riding implements Mower { @Override public void mow() { System.out.println("Riding mowers provide safety and comfort."); }}
The Push class represents the class object for the push mower type. ...
Read now
Unlock full access