问题 补全对话,情景问答

补全对话。

A: Do you want to go to a (1) m_______, Tom?

B: Yes, that (2) s_______ good.

A: What (3) k_______ of movies do you like?

B: I like (4) c_______. Because they're (5) f_______. And I think (6) t_______ are great.

A: How about (7) d_______?

B: I don't like documentaries. I think they're (8) b_______. What kind of movies do you like?

A: I like (9) a_______ movies. I think they're (10) e_______.

答案

1. movie   2. sounds   3. kind   4. comedies   5. funny

6. thrillers   7. documentaries   8. boring   9. action   10. exciting

多项选择题
填空题

阅读下列说明和Java代码,将应填入 (n) 处的字句写在对应栏内。

[说明]

现欲构造一棵文件/目录树,采用组合(Composite)设计模式来设计,得到的类图如图18-20所示。

[Java代码]

import Java.util.ArrayList;

import Java.util.List;

(1) class AbstractFile

protected String name;

public void printName()System.out.printin(name);

public abstract boolean addChild(AbstractFile file);

public abstract boolean removeChild(AbstractFile file);

public abstract List<AbstractFile>getChildren();

class File extends AbstractFile

public File(String name)this.name=name;

public boolean addChild(AbstractFile file)return false;

public boolean removeChild(AbstractFile file) return false;

public List<AbstractFile>getChildren()return (1)

class Foider extends AbstractFiie

private List<AbstractFile>childList;

public Folder(String name)

this.name=name;

this.childList=new ArrayList<AbstractFile>();

public boolean addChild(AbstractFile file) return childList.add(file);

public boolean removeChild(AbstractFile file) return childList.remove(file);

public (3) <AbstractFile>getChildren()return (4)

public class Client

public static void main(String[]args)

//构造一个树形的文件/目录结构

AbstractFile rootFoider=new Foider("C:\\");

AbstractFile compositeFolder=new Folder("composite");

AbstractFile windowsFoider=new Foider("windows");

AbstractFile file=new File("TeStCompoSite.java");

rootFolder.addChild(compositeFoider);

rootFoider.addChild(windowsFolder);

compositeFolder.addChild(file);

//打印目录文件树

printTree(rootFolder);

private static void printTree(AbstractFile ifile)

ifile.printName();

List<AbstractFile>children=ifile.getChildren();

if(children==null) return;

for(AbstractFile file:children)

(5)

该程序运行后输出结果为:

C:\

composite

TestComposite.java

Windows

(3)处填()。