15、以下程序的执行结果为? public class Test { int count=8; public void m(){ for(int count=1;count<2;count++) System.out.print(count); System.out.print(count); } public static void main(String args[ ]) { new Test().m(); } }A.12B.123C.128D.18

15、以下程序的执行结果为? public class Test { int count=8; public void m(){ for(int count=1;count<2;count++) System.out.print(count); System.out.print(count); } public static void main(String args[ ]) { new Test().m(); } }

A.12

B.123

C.128

D.18


参考答案和解析
程序编译不通过

相关考题:

如下程序的输出结果是______。 include using namespace std; class pumpkin{ publ 如下程序的输出结果是______。include<iostream>using namespace std;class pumpkin{public:pumpkin( ){++count;}~pumpkin( ){--eount;}static void total_count( ){cout<<count<<"pumpkin(s)"<<endl;}private:static int count;};int pumpkin::count=0;int main( ){pumpkin pl[10];pumpkin::total_count( );return 0;}

下面程序的运行结果是【】。 inChlde using namespace std; class count { static int n; 下面程序的运行结果是【 】。inChlde<iOStream>using namespace std;class count{static int n;public:count(){n++;}static int test(){for(int i=0:i<4;i++)n++;return n;}};int count::n=0;int main(){cout<<COUnt::test()<<" ";count c1, c2;cout<<count::test()<<end1;return 0;}

若有如下程序:public class Test {public static void main (String[] args) {int x=20;if (x>10) System.out.print(x-=5);if (x>5) System.out.print(x--);}}则程序运行后的输出结果是【 】。

下列程序段的输出结果是【 】。public class Test {void printValue(int m) {do {System.out.println("The value is"+m);}while (--m>10);}public static void main (String args[]) {int i=10;Test t= new Test();t.printValue(i);}}

( 27 )有如下程序:#includeiostreamusing namespace std;class MyClass{public:MyClass(){++count;}~MyClass(){--count;}static int getCount(){return count;}private:static int count;};int MyClass::count=0;int main(){MyClass obj;coutobj.getCount();MyClass*ptr=new MyClass;coutMyClass::getCount();delete ptr;coutMyClass::getCount();return 0;}程序的输出结果是A ) 121B ) 232C ) 221D ) 122

如下程序的输出结果是( )。 public class Test { void printValue(int m) { do { System.out.println("The value is"+m); } while( --m>10) } public static void main(String args[]) { int i=10; Test t=new Test(); t.printValue(i); } }A.The value is 8B.The value is 9C.The value is 10D.The value is 11

下面程序的正确输出是( )。 public class Hello { public static void main(String args[]) { int count, xPos=25; for ( count=1; count<=10; count++ ) { if ( count==5 ) break; System.out.println(count ); xPos += 10; } } }A.1 2 3 4B.1 3 4C.编译错误D.以上都不是

( 35 )有如下程序:#include iostreamusing namespace std;Class B{public:B(int xx):x(xx) {++cout; x+=10;}virtual void show() const{coutcount ' _ ' xendl;}protected:static int count;private:int x;};class D:public B{public:D(int xx,int yy):B(xx),y(yy) {++count; y+=100;}virtual void show() const{coutcount ' _ ' yendl;}private:int y;};int B::count=0;int main(){B *ptr=new D(10,20);ptr-show();delete ptr;return 0;}运行时的输出结果是A ) 1_120B ) 2_120C ) 1_20D ) 2_20

有如下程序: include using namespace std; class MyClass { public: 有如下程序: #include <iostream> using namespace std; class MyClass { public: MyClass() { ++count; } ~MyClass() { --count; } static int getCount() { return count; } private: static int count; }; int MyClass::count=0; int main() { MyClass obj; cout<<obj.getCount(); MyClass *ptr=new MyClass; cout<<MyClass::getCount(); delete ptr; cout<<MyClass::getCount(); return 0; }程序的输出结果是A.121B.232C.221D.122

有如下程序: #include using name space std; classB{ public: B(int xx):x(xx){++count;x+=10;} virtual void show()const {cout<<count'_'<<x<<endl;} protected: static int count; private: intx; }; class D:publicB{ public: D(int xx,int yy):B(xx),y(yy){++count;y+=100;} virtual void show()const {cout<<count<<'_'<<y<endl}; pnvate: inty; }; int B::count=0; intmain(){ B*ptr=new D(10,20); ptr-show(); delete ptr; return 0; } 运行时的输出结果是( )。A.1_120B.2_120C.1_20D.2_20

下面程序的运行结果是【】。 include using namespace std; class count{ static int n; 下面程序的运行结果是【 】。include <iostream>using namespace std;class count{static int n;public:count(){n++;}static int test(){for(int i=0;i<4;i++)n++;return n;}};int count::n = O;int main(){cout<<count:: test()<<" ";count c1, c2;cout<<count:: test()<<endl;return 0;}

有如下程序: include using namespace std; class pumpkin{ public:pumpkin(){++count 有如下程序:include<iostream>using namespace std;class pumpkin{public:pumpkin(){++count;}~pumpkin(){--count;}static void total_count(){cout<<count<<"pumpkin(s)"<<end1;}private:static int count;};int pumpkin::count=0;int main(){pumpkin p1[10];pumpkin::total_count();return 0;}这个程序的输出结果是______。

有如下程序:includeusing namespace std;elass MyClass{public:MyClass( ){++count; 有如下程序: #include<lostreanl> using namespace std; elass MyClass{ public: MyClass( ){++count;} ~MyClass( ){--count;} static int getCount( ){return count;} private: static int count; }; int MyClass::count=0; int main( ){ MyClass obj; cout<<obj.getCount( ); MyClass*ptr=new MyClass; cout<<MyClass::getCount( ); delete ptr; cout<<MyCiass::getCount( ); return 0; } 程序的输出结果是A.121B.232C.221D.122

有如下程序:#includeiostreamusing namespace std;class Toy{public:Toy(char*_n){strcpy(name,_n);count++;}~Toy()}count--;}char*GetName(){return name;}static int getCount(){return count;}private:char name[10];static int count;};int Toy::count=O:int main(){Toy tl(“Snoopy”),t2(“Mickey”),t3(“Barbie”);coutt1.getCount()endl;return O:}运行时的输出结果是A.1B.2C.3D.运行时出错

有以下程序:include using namespace std;class count{ static int n;public: count 有以下程序: #include <iostream> using namespace std; class count { static int n; public: count ( ) { n++; } static int test() { for (int i = 0; i < 4; i++ ) n++; return n; } }; int count :: n = 0; int main() { cout<<count :: test()<<" "; count c1, c2; cout<<count :: test()<<end1; return 0; } 执行后的输出结果是( )。A.4 10B.1 2C.22D.24

有如下程序:includeusing namespace std;class MyClass{public:MyClass(){++count;}~ 有如下程序: #include<iostream> using namespace std; class MyClass{ public: MyClass(){++count;} ~MyClass(){--count;} static int getCount(){return count;} private: static int count; }; int MyClass::count=0; int main(){ MyClA.121B.232C.221D.122

下列程序的输出结果是 class Demo { void test( ) { Systeme.out.pnnt("NO");} void test(int i) { System.out.print(a);} void test(int a,int b) { System.out.print(a+b);} } class Test { public static void main(String args[ ] ) { Demo de=new Demo( ); de.test( ); de.test(5); de.test(6,8); } }A.No 5 6 8B.5 6 8 NoC.No 5 14D.8 6 No 5

有如下程序:includeusing namespace std;class Toy{public:Toy(char*_n){strcpy(name 有如下程序: #include<iostream> using namespace std; class Toy{ public: Toy(char*_n){strcpy(name,_n);count++;} ~Toy(){count--;} char*GetName( ){return name;} static int getCount( ){return count;} private: char name[10]; static int count; }; int Toy::count=0: int main( ){ Toy tl("Snoopy"),t2("Mickey"),t3("Barbie"); cout<<t1.getCount( )<<endl; return 0; } 程序的输出结果是A.1B.2C.3D.运行时出错

有如下程序: #inCludeiostream using namespaCe耐: Class MyClass{ publiC: MyClass{++Count;} ~MyClass{--Count;} statiC int getCount{retum Count;} private: statiC int Count; }; ‘ int MyClass::Count=0; int main { MyClass obj; Coutobj.getCount; MyClass+ptr=new MyClass: CoutMyClass::9etCount; ’delete ptr; CoutMyClass::9etCount; return 0; } 执行这个程序的输出结果是( )。A.121B.232C.221D.122

下列程序的输出结果是______。 include using namespace std; class Test( public: Te 下列程序的输出结果是______。 #include<iostream> using namespace std; class Test( public: Test() {cnt++;} ~Test() {cnt--;} static int Count(){return cnt;} private: static int cnt; }; int Test::cnt=0; int main() { cout<<Test::Count()<<""; Test t1,t2; Test*pT3=new Test; Test*pT4=new Test; cout<<Test::Count()<<""; delete pT4; delete pT3; cout<<Test::Count()<<end1; return 0; }A.024B.042C.420D.240

下列程序的输出结果是 ( ) class Derao { void test() { Systeme.out.print("NO");} void test (int i) {System.out.print(a);} void test(int a,int b) {System.out.print(a+b);} } class Test { public static void main(String args[]) { Demo de=new Demo(); de.test(); de.test5.; de.test(6,8); } }A.No568B.568NoC.No514D.86No5

以下程序的输出结果为:public class test {public static void main(String args[]) {int m=0;for ( int k=0;k A. 000B. 012C.123D.111

以下程序调试结果为:public class Test {int m=5;public void some(int x) {m=x;}public static void main(String args []) {new Demo().some(7);}}class Demo extends Test {int m=8;public void some(int x) {super.some(x);System.out.println(m);}}A.5B.8C.7D.无任何输出E.编译错误

编译如下Java程序片断:  class test{  int count = 9;  public void a(){    int count=10;  System.out.println("count 1 =" + count);  }  public void count(){  System.out.println("count 2 =" + count);  }  public static void main(String args[]){    test t=new test();    t.a();   t.count();   } }  结果将()。    A、不能通过编译B、输出: count 1 = 10 count 2 = 9C、输出:count 1 = 9 count 2 = 9

多选题public class NamedCounter {  private final String name;  private int count;  public NamedCounter(String name) { this.name = name; }  public String getName() { return name; }  public void increment() { coount++; }  public int getCount() { return count; } public void reset() { count = 0; } }  Which three changes should be made to adapt this class to be used safely by multiple threads? ()Adeclare reset() using the synchronized keywordBdeclare getName() using the synchronized keywordCdeclare getCount() using the synchronized keywordDdeclare the constructor using the synchronized keywordEdeclare increment() using the synchronized keyword

单选题编译如下Java程序片断:  class test{  int count = 9;  public void a(){    int count=10;  System.out.println("count 1 =" + count);  }  public void count(){  System.out.println("count 2 =" + count);  }  public static void main(String args[]){    test t=new test();    t.a();   t.count();   } }  结果将()。A不能通过编译B输出: count 1 = 10 count 2 = 9C输出:count 1 = 9 count 2 = 9

单选题编译如下的Java程序片段:  Class test{     Int count=9;     Public void a(){   Int count=10;   System.out,println(“count 1=” + count); }  Public void count(){   System.out.println(“count 2 =”+ count); }  Public static void main(String args[] ){   Test t=new Test();   t.a();   t.count(); } }  结果是()A不能通过编译B输出:count 1 =10  count 2=9C输出:count 1=9 count 2=9

单选题下列程序的运行结果是(  )。class Shape{ public Shape(){ System.out.print("Shape"); }}class Circle extends Shape{ public Circle(){ System.out.print("Circle"); }}public class Test{ public static void main(String[]args){ Shape d=new Circle(); }}AShapeBCircleCShapeCircleD程序有错误