class TestMain {&ensp

题目

class TestMain {       static int x = 2;    static { x = 4; }   public static void main(String... args) {     int y = x + 1;   System.out.println(y);    }  }    和命令行:  java TestMain   结果为:()  

  • A、 3
  • B、 5
  • C、 编译失败
  • D、 运行时异常被抛出
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Acompanyhasabusinessapplicationthatprovides&ensp

Acompanyhasabusinessapplicationthatprovidesitsuserswithmanydifferentreports:receivablesreports,payablesreports,revenueprojects,andsoon.Thecompanyhasjustpurchasedsomenew,state-of-the-art,wirelessprinters,andaprogrammerhasbeenassignedthetaskofenhancingallofthereportstousenotonlythecompany’soldprinters,butthenewwirelessprintersaswell.Whentheprogrammerstartslookingintotheapplication,theprogrammerdiscoversthatbecauseofthedesignoftheapplication,itisnecessarytomakechangestoeachreporttosupportthenewprinters.

Whichtwodesignconceptsmostlikelyexplainthesituation?()


参考答案:B, C

第2题:

WhichmethodintheThreadclassisusedtocreateandlaunchanewthreadofexecution?()

A. Run();

B. Start();

C. Execute();

D. Run(Runnable r);

E. Start(Runnable r);

F. Execute(Thread t);


参考答案:B

第3题:

YourcompanyhasamainofficeinChicagoand&ensp

YourcompanyhasamainofficeinChicagoandabranchofficeinNewYork.ThecompanyhasasingleActiveDirectorydirectoryserviceforestwithfourdomains.Twoofthedomaincontrollersaredescribedinthefollowingtable.

Anapplicationhasaservercomponentandaclientcomponent.Whentheservercomponentisinstalled,severalschemaclassesandattributesareadded.Auserinthene.sales.contoso.comdomaininstallstheclientcomponentonhisclientcomputer.Youtheninstalltheservercomponent.Thirtyminutesafteryouinstalltheservercomponent,theuserattemptstoruntheclientcomponent,butreceivesanerrormessagestatingthattheschemaobjectscannotbefound.YouverifythattheobjectsarepresentonDC1.TheuserslogonserverisDC4.Youneedtoensurethattheusercanimmediatelyruntheclientcomponent.

Whatshouldyoudo?()


参考答案:C

第4题:

下面程序输出的结果为 #include"iostream.h” class A { public: A(){cout<<"CLASSA"<<endl;} ~A() {} }; class B:public A { public: B(){cout<<"CLASS B"<<endl;} ~B(){} }; void main() { A*p; p=new B;

A.CLASS A CLASS B CLASS B CLASS B

B.CLASS A CLASS B CLASS A CLASS B

C.CLASS A CLASS B CLASS B

D.CLASS A CLASS B


正确答案:C

第5题:

下面程序输出的结果为 #include"iostream.h" class A { public: A(){cout<<"CLASSA"<<endl;} ~A() {} }; class B:public A { public: B(){cout<<"CLASSB"<<endl;} ~B() {} }; void main() { A * p; p=new B; B *q; q=new B; }

A.CLASS A CLASS B

B.CLASS A CLASS B CLASS B

C.CLASS A CLASS B CLASS A CLASS B

D.CLASS A CLASS B CLASS B CLASS B


正确答案:C
解析:每实例化一个类就要调用其构造函数,结束运行该实例后调用析构函数。注意:类的实例化和构造函数、析函数的调用方式和何时调用。

第6题:

ClicktheExhibitbutton.Assumingthetaglibraryintheexhibitisimportedwiththeprefixstock,whichcustomtaginvocationoutputsthecontentsofthevariableexposedbythequotetag?()

A.<;stock:quote&ensp;symbol=";SUNW";&ensp;/>;${var}

B.${var}.&ensp;<;stock:quote&ensp;symbol=";SUNW";&ensp;/>;

C.<;stock:quote&ensp;symbol=";SUNW";>;.&ensp;${var}.&ensp;<;/stock:quote>;

D.<;stock:quote&ensp;symbol=";SUNW";&ensp;var=";quote";&ensp;/>;${quote}


参考答案:D

第7题:

Yousettherecoverywindowtosevendaysand&ensp

YousettherecoverywindowtosevendaysandthebackupoptimizationtoONusingtheCONFIGUREcommandofRecoveryManager(RMAN).ThemostrecentbackupoftheTOOLStablespacetodiskwastakenonJanuary3.TheTOOLStablespaceisreadonly.

OnFebruary21,whenyouexecuteacommandtobackupallthetablespacestodisk,youfindthatRMANbacksuptheTOOLStablespacealso,eventhoughthecontentsofthetablespacehavenotchangedafterthebackuponJanuary3.

BecausetherearenochangesmadetotheTOOLStablespace,youdecidethatthetablespaceshouldnotbebackedupbyRMAN.WhatcanyoutodoskipbackinguptheTOOLStablespacewithoutchangingthecurrentbackupoptimizationsetting?()


参考答案:B

第8题:

YouarecreatingaWeb-basedapplicationtomanage&ensp

YouarecreatingaWeb-basedapplicationtomanagedataaggregationforreports.TheapplicationconnectstoaSQLServer2005databasenamedDataManager.OnepageintheapplicationhascontrolsthatexecutestoredproceduresinadatabasenamedReportingDatabase.ThereisanexistingServiceBrokerconnectionbetweentheDataManagerdatabaseandReportingDatabase.Youwanttoaddtwonewmessagetypestotheexistingservice.Ineachdatabase,youcreatemessagetypesnamedProcessReportandSendResult.Youneedtoaddthetwonewmessagetypestotheexistingservice.

Whatshouldyoudofirst?()


参考答案:C

第9题:

下面程序输出的结果为

#include"iostream.h"

class A

{

public:

A( ){cout<<"CLASS A"<<endl;}

~A( ){}

};

class B:public A

{

public:

B( ){cout<<"CLASS B"<<endl;}

~B( ){}

};

void main( )

{

A*p;

p=new B;

B *q;

q=new B;

}

A.CLASS A CLASS B

B.CLASS A CLASS B CLASS B

C.CLASS A CLASS B CLASS A CLASS B

D.CLASS A CLASS B CLASS B CLASS B


正确答案:C
解析:每实例化一个类就要调用其构造函数,结束运行该实例后调用析构函数。注意:类的实例化和构造函数、析构函数的调用方式和何时调用。

第10题:

下面程序输出的结果为( )。 #inClUde”iostream.h” Class A {public: A(){cout<<“CLASS A”<<endl;} ~A()<)}; class B:public A {public: B(){cout<<”CLASSB”<<endl;} ~B(){}}; void main() {A*p; p=new B; B *q; q=new B;}

A.CLASS A CLASS B

B.CLASS A CLASS B CLASS B

C.CLASS A ClASS B

D.CLASS A CLASS B CLASS A CLASS B CLASS B CLASS B


正确答案:C
解析: 本题考查类的继承、类的实例化和构造函数、析构函数的调用方式和何时调用。每实例化一个类就要调用其构造函数,结束运行该实例后调用析构函数。

更多相关问题