现有classBeverage{Beverage(){System.out.print(beverage);}}classBeerextendsBeverage{publicstaticvoidmain{string[]args){Beerb=newBeer(14);}publicintBeer(intx){this();System.out.print(beerl);}publicBeer(){System.out.print(beer2);}}结果是什么?()A.beerlbeverageB.beer2beverageC.beveragebeer2beerlD.编译失败
现有classBeverage{Beverage(){System.out.print("beverage");}}classBeerextendsBeverage{publicstaticvoidmain{string[]args){Beerb=newBeer(14);}publicintBeer(intx){this();System.out.print("beerl");}publicBeer(){System.out.print("beer2");}}结果是什么?()
A.beerlbeverage
B.beer2beverage
C.beveragebeer2beerl
D.编译失败
相关考题:
在PowerPoint 2003中,删除幻灯片的操作可以是()。A.单击常用工具栏中的quot粘贴quot按钮B.选择quot编辑quot菜单中的quot删除幻灯片quot选项C.选择quot编辑quot菜单中的quot清除quot选项D.单击常用工具栏中的quot复制quot按钮
在PowerPoint 2003启动幻灯片放映的操作中,错误的是()。A.单击演示文稿窗口左下角的quot幻灯片放映quot视图按钮B.选择quot幻灯片放映quot菜单中的quot观看放映quot命令C.选择quot幻灯片放映quot菜单中的quot幻灯片放映quot命令D.按F5键
在PowerPoint中,若想给“文本框”对象或“文本框占位符”设置动画效果,下列说法正确是()。A.执行quot格式quot菜单的quot幻灯片设计quot命令,右侧有一个相应的设置窗格B.执行quot幻灯片反映quot菜单的quot自定义动画quot命令,右侧有一个相应的设置窗格C.执行quot格式quot菜单的quot幻灯片版式quot命令,右侧有一个相应的设置窗格D.以上说法全错
classBeverage{Beverage(){System.out.print(beverage);}}classBeerextendsBeverage{publicstaticvoidmain(String[]args){Beerb=newBeer(14);}publicintBeer(intx){this();System.out.print(beer1);}publicBeer(){System.out.print(beer2);}}结果是什么?()A.beer1beverageB.beer2beverageC.beveragebeer1D.编译失败
现有:classBirds{publicstaticvoidmain(String[]args){try{thrownewException();}catch(Exceptione){try{thrownewException();}catch(Exceptione2){System.out.print(inner);}System.out.print(middle);}System.out.print(outer);}}结果是()A.innerouterB.middleouterC.innermiddleouterD..编译失败
试题五(共15分)阅读下列说明和C++代码,将应填入(n)处的字句写在答题纸的对应栏内。【说明】某咖啡店当卖咖啡时,可以根据顾客的要求在其中加入各种配料,咖啡店会根据所加入的配料来计算费用。咖啡店所供应的咖啡及配料的种类和价格如下表所示。【C++代码】include iostreaminclude stringusing namespace std;const int ESPRESSO_PRICE = 25;const int DRAKROAST_PRICE = 20;const int MOCHA_PRICE = 10;const int WHIP_PRICE = 8;class Beverage { //饮料(1) :string description;public:(2) (){ return description; }(3) ;};class CondimentDecorator : public Beverage { //配料protected:(4) ;};class Espresso : public Beverage { //蒸馏咖啡public:Espresso () {description="Espresso"; }int cost(){return ESPRESSO_PRICE; }};class DarkRoast : public Beverage { //深度烘焙咖啡public:DarkRoast(){ description = "DardRoast"; }int cost(){ return DRAKROAST_PRICE; }};class Mocha : public CondimentDecorator { //摩卡public:Mocha(Beverage*beverage){ this-beverage=beverage; }string getDescription(){ return beverage-getDescription()+",Mocha"; }int cost(){ return MOCHA_PRICE+beverage-cost(); }};class Whip :public CondimentDecorator { //奶泡public:Whip(Beverage*beverage) { this-beverage=beverage; }string getDescription() {return beverage-getDescription()+",Whip"; }int cost() { return WHIP_PRICE+beverage-cost(); }};int main() {Beverage* beverage = new DarkRoast();beverage=new Mocha( (5) );beverage=new Whip( (6) );coutbeverage-getDescription()"¥"beverage-cost() endl;return 0;}编译运行上述程序,其输出结果为:DarkRoast, Mocha, Whip ¥38
试题六(共15分)阅读下列说明和Java代码,将应填入(n)处的字句写在答题纸的对应栏内。【说明】某咖啡店当卖咖啡时,可以根据顾客的要求在其中加入各种配料,咖啡店会根据所加入的配料来计算费用。咖啡店所供应的咖啡及配料的种类和价格如下表所示。【Java代码】import java.util.*;(1) class Beverage { //饮料String description = "Unknown Beverage";public (2) (){return description;}public (3) ;}abstract class CondimentDecorator extends Beverage { //配料(4) ;}class Espresso extends Beverage { //蒸馏咖啡private final int ESPRESSO_PRICE = 25;public Espresso() { description="Espresso"; }public int cost() { return ESPRESSO_PRICE; }}class DarkRoast extends Beverage { //深度烘焙咖啡private finalint DARKROAST_PRICE = 20;public DarkRoast() { description = "DarkRoast"; }public int cost(){ rcturn DARKROAST PRICE; }}class Mocha extends CondimentDecorator { //摩卡private final int MOCHA_PRICE = 10;public Mocha(Beverage beverage) {this.beverage = beverage;}public String getDescription() {return beverage.getDescription0 + ", Mocha";}public int cost() {return MOCHA_PRICE + beverage.cost();}}class Whip extends CondimentDecorator { //奶泡private finalint WHIP_PRICE = 8;public Whip(Beverage beverage) { this.beverage = beverage; }public String getDescription() {return beverage.getDescription()+", Whip";}public int cost() { return WHIP_PRICE + beverage.cost(); }}public class Coffee {public static void main(String args[]) {Beverage beverage = new DarkRoast();beverage=new Mocha( 5 );beverage=new Whip ( 6 );System.out.println(beverage.getDescription() +"¥" +beverage.cost());}}编译运行上述程序,其输出结果为:DarkRoast, Mocha, Whip ¥38