classOne{publicOne(){System.out.print(1);}}classTwoextendsOne{publicTwo(){System.out.print(2);}}classThreeextendsTwo{publicThree(){System.out.print(3);}}publicclassNumbers{publicstaticvoidmain(String[]argv){newThree();}}Whatistheresultwhenthiscodeisexecuted?()A.1B.3C.123D.321E.Thecoderimswithnooutput.
classOne{publicOne(){System.out.print(1);}}classTwoextendsOne{publicTwo(){System.out.print(2);}}classThreeextendsTwo{publicThree(){System.out.print(3);}}publicclassNumbers{publicstaticvoidmain(String[]argv){newThree();}}Whatistheresultwhenthiscodeisexecuted?()
A.1
B.3
C.123
D.321
E.Thecoderimswithnooutput.
相关考题:
有如下程序:#includeusing namespace std;class ONE{public:virtual void f(){cout"l";}};class TWO:public ONE{public:TWO(){cout"2";}};class THREE:public TWO{public:virtual void f(){TWO::f(); cout"3";}};int main(){ONE aa, *p;TWO bb;THREE cc;p = cc;p-f();return 0;}执行上面程序的输出是 【 11 】 。
有如下程序: include using namespaee std; class ONE{ public: virtual void f 有如下程序:include <iostream>using namespaee std;class ONE{public:virtual void f( ){cout<<"1";}};class TWO:public ONE{public:TWO( )1 cout<<"2";}{;class THREE:public TWO{public:virtual void f( )}TWO::f( );cout<<"3";}};int main( ){ONE aa,*P;TWO bb;THREE cc;P=cc;p->f( );return 0;}程序的输出结果是______。
有如下程序: include using namespace std; class ONE { public: virtual void f() { 有如下程序:include <iostream>using namespace std;class ONE{public:virtual void f() { cout << "1"; }};class TWO: public ONE{public:TWO() { cout << "2"; }};class THREE: public TWO{public:virtual void f() {TWO::f(); cout << "3"; }};int main(){ONE aa, *p;TWO bb;THREE cc;p=cc;P->f();return 0;}执行上面程序的输出是【 】。
publicclassPet{privateStringname;publicPet(){System.out.print(1);}publicPet(Stringname){System.out.print(2);}}publicclassDogextendsPet{publicDog(){System.out.print(4);}publicDog(Stringname){super(name);System.out.print(3);}}执行newDog(棕熊”);后程序输出是哪项?()A.33B.13C.23D.123
publicclassTwoThreads{privatestaticObjectresource=newObject();privatestaticvoiddelay(longn){try{Thread.sleep(n);}catch(Exceptione){System.out.print(”Error);}}publicstaticvoidmain(String[]args){System.out.print(”StartMain);newThread1().start();delay(1000);Threadt2=newThread2();t2.start();delay(1000);t2.interruptdelay(1000);System.out.print(”EndMain);}staticclassThread1extendsThread{publicvoidrun(){synchronized(resource){System.out.print(”Startl);delay(6000);System.out.print(”End1);}}}staticclassThread2extendsThread{publicvoidrun(){synchronized(resource){System.out.print(”Start2);delay(2000);System.out.print(”End2);}}}}Assumethatsleep(n)executesinexactlymmilliseconds,andallothercodeexecutesinaninsignificantamountoftime.Whatistheoutputifthemain()methodisrun?()
publicclassX{publicstaticvoidmain(String[]args){try{badMethod();System.out.print(A”);}catch(RuntimeExceptionex){System.out.print(B”);}catch(Exceptionex1){System.out.print(C”);}finally{System.out.print(D”);}System.out.print(E”);}publicstaticvoidbadMethod(){thrownewRuntimeException();}}Whatistheresult?()A.BDB.BCDC.BDED.BCDEE.ABCDEF.Compilationfails.
有下列程序:includeusing namespace std;class ONE{ public:virtual void f(){COUt 有下列程序:include<iostream>using namespace std;class ONE{public:virtual void f(){COUt<<"1";}};c1assTWO:public ONE{public:TWO(){cout<<"2";}};class THREE:public TWO{pub
执行下列Java语句:int x = 1; switch (x+1 ) { case 1: System.out.print("One" ); case 2: System.out.print("Two" ); case 3: System.out.print("Three" ); default: System.out.print("Error" ); } 显示器上将显示()。A.OneB.TwoC.TwoThreeD.TwoThreeError
下列程序的输出结果是 for(int i=0;i<5;i++){ switch(i){ case 0:System.out.print("B"); case 1:System.out.print("e");break; case 2:System.out.print("g"); case 3:System.out.print("!");break; case 4:System.out.print("!");break; default:System.out.print("!"); } }A.Beg!!!B.Beeg!C.Beg!D.Beeg!!!