这个题到底要求做什么,完全懵逼啊
package zh.codegym.task.task14.task1414;
/*
电影工厂
*/
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
String key = null;
MovieFactory.getMovie(key);
}
static class MovieFactory {
static Movie getMovie(String key) {
Scanner sc = new Scanner(System.in);
Movie movie = null;
key = sc.nextLine();
while (true) {
if (!"soapOpera".equals(key)) {
break;
} else if (!"cartoon".equals(key)) {
break;
} else if (!"thriller".equals(key)) {
break;
}
if("cartoon".equals(key)){
return new Cartoon();
}
if("thriler".equals(key)){
return new Thriler();
}
}
return movie;
}
}
static abstract class Movie {
public Movie movie;
}
static class SoapOpera extends Movie {
}
static class Cartoon extends Movie {
}
static class Thriler extends Movie {
}
}