題組內容
七、
public class X
{public String whatIAm() {return “I’m an X.”;}}
public class Y extends X
{public String whatIAm() {return “I’m a Y.”;}}
public static void main(String[] args) throws IOException
{ X x;
BufferedReader reader = new BufferedReader
(new InputStreamReader(System.in));
if (reader.readLine().equals(“Go with X”)) x = new X();
else x = new Y();
System.out.println(x.whatIAm());
} // main