网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
代码public static const int A=1;中的错误是()
A

 A需要定义类型

B

 格式错误

C

 const不能用static修饰符

D

 const不能用public修饰符


参考答案

参考解析
解析: 暂无解析
更多 “单选题代码public static const int A=1;中的错误是()A  A需要定义类型B  格式错误C  const不能用static修饰符D  const不能用public修饰符” 相关考题
考题 有如下程序#includeusing namespace std;int i=1;class Fun{public;static int i;int value(){return i-1}int value ()const{return i+1;}};int Fun;;i=2;int main(){int i=3;Fun Fun1const Fun fun2;return 0;}若程序的输出结果是:123则程序中下划线处遗漏的语句是______。A.coutB.coutC.coutD.cout

考题 有如下类定义:class AA{int a;public:int getRef() const{return a;} // ①int getvalue() const{return a;} // ②void set(int n) const{a=n;} // ③friend void show(AA aa) const {cout // ④};其中的四个函数定义中正确的是A . ①B . ②C . ③D . ④

考题 有如下类定义:class Test{public:Test(){ a = 0; c = 0;} // ①int f(int a)const{this-a = a;} // ②static int g(){return a;} // ③void h(intB . {Test::b = b;}; // ④private:int a;static int b;const int c;};int Test::b = 0;在标注号码的行中,能被正确编译的是A . ①B . ②C . ③D . ④

考题 ( 28 ) 有如下程序#includeusing namespace std;int i=1;class Fun{public:static int i;int value( ){ return i-1;}int value( )const{ return i+1;}};int Fun::i=2;int main( ){int i=3;Fun fun1;const Fun fun2;____________return 0;}若程序的输出结果是 :123则程序中下划线处遗漏的语句是A ) coutFun::iB ) coutFun::ifun1.value()C ) coutFun::i;D ) cout

考题 ( 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

考题 下面代码段的输出结果为( )。 public class Test { public static void main(String sss[]) { int i=0xFFFFFFFl; int j=~i; } }A.0B.1C.14D.-15

考题 阅读下列代码后 public class Person{ int arr[]=new int[10]; public static void main(String args[]){ System.out.println(arr[1]); } } 正确的说法是( )。A.编译时将产生错误B.编译时正确,运行时将产生错误C.输出零D.输出空

考题 阅读下列代码Public class Person{Static int arr[ ] = new int (10);Public static void main (String args ) {System.out.println(arr[9]);}}该代码运行的结果是A )编译时将产生错误B )编译时正确,运行时将产生错误C )输出 0D )输出空

考题 有如下程序 include using namespace std;int i=1;class Fun {public:static int i;i 有如下程序 #include <iostream>using namespace std;int i=1;class Fun {public:static int i;int value(){ return i-1;}int value()const{ return i+1;}};int Fun:: i=2;int main() {int i=3;Fun fun1;const Fun fun2;______________________return ();}若程序的输出结果是:123A.cout<<fun1.value()<<Fun:: i<<fun2.value();B.cout<<Fun::i<<fun1.value()<<fun2.value();C.cout<<fun1. value()<<fun2.value()<<Fun:: i;D.cout<<fun2.value()<<Fun:: i<<fun 1.value();

考题 main函数中发生编译错误的语句是______。 include class A { public: int a; const i main函数中发生编译错误的语句是______。include<iostream.h>class A{public:int a;const int b;A( ):a(10),b(20){}void fun( )const{cout<<"a="<<a<<"\tb="<<b<<endl;}};void main( ){A obj1;const A*ptr=new A;ptr=obj1;ptr->a=100;ptr->fun( );}

考题 已知如下类说明: public class Test { private float f = 1.0f; int m = 12; static int n=1; public static void main(String arg[]) { Test t = new Test(); // 程序代码… } } 如下哪个使用是正确的?() A.t.fB.this.nC.Test.mD.Test.n

考题 给出下列代码,如何使成员变量m被方法fun( )直接访问?Class Test{private int m;public static void fun( ){} }A.将private int m改为protected int mB.将private int m改为public int mC.将private int m改为static int mD.将private int m改为int m

考题 给出下列代码,如何使成员变量m被方法fun( )直接访问? class Test{ private int m; public static void fun( ){ … } }A.将private int m改为protected int mB.将private int m改为public int mC.将private int m改为static iD.将private int m改为int m

考题 下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}A.编译错误B.0C.1D.运行成功,但不输出

考题 阅读下面代码 public class Person { static int arr[]=new int[10]; public static void main(String args) { System.out.println(arr[9]); } } 该代码的运行结果是A.编译时将产生错误B.编译时正确,运行时将产生错误C.输出零D.输出空

考题 有如下程序:includeusing namespace std;int i=1;class Fun{public:static int i;int 有如下程序: #include<iostream> using namespace std; int i=1; class Fun { public: static int i; int value(){return i-1;} int value()const{return i+1;} }; int Fun::i=2; int main() { int i=3; Fun fun 1; const Fun fun2; ______ return 0; } 若程序的输出结果是: 123 则程序中横线处的语句是( )。A.cout<<fun1.value()<<Fun::i<<fun2.value();B.cout<<Fun::i<<fun1.value()<<fun2.value();C.count<<fun.value()<<fun2.value()<<Fun::i;D.cout<<fun2.value()<<Fun::i<<fun1.value();

考题 有如下类定义: class Test { public: Test(){a=0;c=0} //① int f(int a)const{this->a=a;} //② static int g(){return a;} //③ void h(int b){Test::b;}; //④ private: int a; static int b; const int C; }; int Test::b=0; 在标注号码的行中,能被正确编译的是( )。A.①B.②C.③D.④

考题 下列代码中,将引起编译错误的行是______。 (1) public class Test { (2) int m,n; (3) public Test( ){} (4) public Test(int A){m=a;} (5) public static void main(String args[ ]){ (6) Test t1,t2; (7) int j,k; (8) j=0;k=0; (9) t1=new Test( ); (10) t2=new Test(j,k); (11) 1 (12) }A.第3行B.第5行C.第6行D.第10行

考题 public static const int A=1;这段代码有错误么?是什么?

考题 下面的例子中using System;class A{public static int X;static A(){X=B.Y+1;}}class B{public static int Y=A.X+1;static B(){}static void Main(){Console.WriteLine("X={0},Y={1}",A.X,B.Y);}}产生的输出结果是什么?

考题 下列代码的执行结果是( )。public class Test{public int aMethod( ){static int i=0;i++;System.out.println(i):}public static void main (String args[]){Trest test=new Test ( );test aMethod( ):}}A.编译错误B.0C.1D.运行成功,但不输出B.C.D.

考题 有如下类定义: class Test { public: Test{a=0;c=0;}//① int f(im A.const{this-a=a;}//② static int g{return a;f//③ void h(int B.{Test:.b=b;};//④ private: int a; static int b; const int C; }; int Test::b=0: 在标注号码的行中,能被正确编译的是( )。A.①B.②C.③D.④

考题 给出下面代码:public class Person{static int arr[] = new int[10];public static void main(String a[]) {System.out.println(arr[1]);}}以下那个说法正确? A. 编译时将产生错误;B. 编译时正确,运行时将产生错误;C. 输出0;D. 输出null。

考题 设有如下代码:class Base{}public class MyCast extends Base{static boolean b1=false;static int i = -1;static double d = 10.1;public static void main(String argv[]){MyCast m = new MyCast();Base b = new Base();//Here}}则在 //Here处插入哪个代码将不出现编译和运行错误。A.b=m;B.m=b;C.d =i;D.b1 =i;

考题 哪一行定义了一个静态变量?()A、public static int i;B、static public int i;C、public int static i;D、int public static i;

考题 代码public static const int A=1;中的错误是()A、 A需要定义类型B、 格式错误C、 const不能用static修饰符D、 const不能用public修饰符

考题 问答题public static const int A=1;这段代码有错误么?是什么?