Home  >  Article  >  Java  >  Java implements simple factory pattern

Java implements simple factory pattern

高洛峰
高洛峰Original
2016-12-15 14:20:091534browse

A farm company is responsible for cultivating various fruits. The fruits in this system include grapes, strawberries and apples. The class diagram is shown in the figure. Please write the program according to the following requirements:

1. Apply the simple factory method mode, and complete the description of its growth status according to the name of the fruit entered on the keyboard in the main program.

2 For related articles, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn