首页
登录
从业资格
阅读下列说明和java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。
阅读下列说明和java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。
免费题库
2022-08-02
18
问题
阅读下列说明和java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。【说明】 某发票(lnvoice)由抬头(Head)部分、正文部分和脚注(Foot)部分构成。现采用装饰(Decorator)模式实现打印发票的功能,得到如图6-1所示的类图。
【java代码】class invoice{public void printInvoice( ){ System.out.println ( "This is the content of the invoice!"); }}class Decorator extends Invoice { protected Invoice ticket; public Decorator(lnvoice t){ ticket = t;} publicvoid printInvoice( ){ if(ticket != null) (1) ; } }class HeadDecorator extends Decorator{ public HeadDecorator(lnvoice t){ super(t);} public void printInvoice ( ){ Systent.out.println( "This is the header of the invoice! "); (2) ; }} class FootDecorator extends Decorator { public FootDecorator(Invoice t){ super(t);} public void printlnvoice( ){ ( 3) ; Systent.out.println( "This is the footnote of the invoice! "); }}Class test { public static void main(String[] args){ Invoice t =new Invioce( ); Invoice ticket; ticket= (4) ; ticket.printInvoice( ); Systent.out.println(“------------------“); ticket= (5) ; ticket.printInvoice( ); }}程序的输出结果为: This is the header of the invoice! This is the content of the invoice! This is the footnote of the invoice! ---------------------------- This is the header of the invoice! This is the footnote of the invoice!
选项
答案
解析
(1) ticket.printInvoice()
(2) ticket.printInvoice()
(3) ticket.printInvoice()
(4) new FootDecorator(new
转载请注明原文地址:https://tihaiku.com/congyezige/2407733.html
本试题收录于:
中级 软件设计师题库软件水平考试初中高级分类
中级 软件设计师
软件水平考试初中高级
相关试题推荐
( )是蠕虫病毒。A.熊猫烧香 B.红色代码 C.冰河 D.爱虫病毒
软件测试的对象包括( )。 ①软件代码使②文档③数据A.①②
传统编译器进行词法分析、语法分析、代码生成等步骤的处理时,前一阶段处理的输出是后
传统编译器进行词法分析、语法分析、代码生成等步骤的处理时,前一阶段处理的输出是后
软件测试的对象不包括()。A.一段功能的实现代码 B.概要设计说明书 C.
软件测试的对象不包括()。A.软件代码 B.软件文档 C.质量保证方法
()属于系统软件,它直接执行高级语言源程序或与源程序等价的某种中间代码。A.
关于软件测试的说法,()是不正确的。A.代码审查是代码检查的一种,是由
软件测试的对象不包括()A.软件代码 B.软件开发过程 C.文档 D.数
以下属于静态测试方法的是_____。A.代码审查 B.判定覆盖 C.路径覆盖
随机试题
[originaltext]Whatdoyouhavefordinner?[/originaltext][originaltext]Hello!
下列属于安全检查目的的是()。A.消除隐患 B.防止事故 C.改善劳动
依照我国《婚姻法》的规定,对于离婚案件的审理,应进行调解,调解无效的,应准予离婚
关于建筑物及高层建筑物变电所,叙述正确的是()。A.变压器一律采用干式变压器
粮谷类主要卫生问题是A.霉菌与霉菌毒素的污染、农药残留、有毒有害物质的污染、仓储
C解题指导:黑色小圆与线段依次按顺时针方向移动90°,故答案为C。
依据隔离开关运维细则管理规定,母线侧隔离开关操作后,应检查检查()是否变位
2017年2季度在线视频移动端广告收入环比增长速度?A.低于0% B.
《资治通鉴》成书于( )。A、西汉 B、东汉 C、北宋 D、南宋
氨氯地平的妊娠毒性分级是()A.X级 B.A级 C.C级 D.D级
最新回复
(
0
)