网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
class A { public byte getNumber() { return 1; } } class B extends A { public short getNumber() { return 2; } public static void main(String args[]) { B b = new B(); System.out.println(b.getNumber()); } } What is the result?()
- A、 1
- B、 2
- C、 An exception is thrown at runtime.
- D、 Compilation fails because of an error in line 8.
- E、 Compilation fails because of an error in line 14.
参考答案
更多 “ class A { public byte getNumber() { return 1; } } class B extends A { public short getNumber() { return 2; } public static void main(String args[]) { B b = new B(); System.out.println(b.getNumber()); } } What is the result?()A、 1B、 2C、 An exception is thrown at runtime.D、 Compilation fails because of an error in line 8.E、 Compilation fails because of an error in line 14.” 相关考题
考题
以下程序输出结果为______。 include using namespace std; class TestClass 1 { publi
以下程序输出结果为______。include<iostream>using namespace std;class TestClass 1{public:TestClass1(){}TestClass1(int i){x1=i;}void dispa(){cout<<"x1="<<x1<<",";}private:int x1;}:class TestClass2:public TestClass1{public:TestClass2(){}TestClass2(int i):TestClass1(i+10){x2=i:}void dispb(){dispa();cout<<"x2="<<x2<<end1;}private:int x2:}:int main(){TestClass2 b(2):b.dispb();return 0;}
考题
在下面的类定义中,this指针的用途是______。 include class Sample { int x,y; publi
在下面的类定义中,this指针的用途是______。include<iostream.h>class Sample{int x,y;public:Sample(int i,int j){x=i;y=j;}void assign(Sample sa);};void Sample::assign(Sample p){if(this!=p){x=p.x;y=p.y;}}
考题
下列程序中横线处正确的语句是()。includeusing namespace std;class TestClass{publi
下列程序中横线处正确的语句是( )。 #include<iostream> using namespace std; class TestClass { public: void fun(){cout<<"TestClass::fun"<<end1;} }; class TestClass1:public TestClass { void fun() { ______//显示调用基类的函数 fun() cout<<"TestClass1::fun"<<end1; } };A.fun();B.TestClass.fun()C.TestClass::fun();D.TestClass->fun();
考题
下面程序输出的结果为 #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 BB.CLASS A CLASS B CLASS BC.CLASS A CLASS B CLASS A CLASS BD.CLASS A CLASS B CLASS B CLASS B
考题
下面程序输出的结果为#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 BB.CLASS A CLASS B CLASS BC.CLASS A CLASS B CLASS A CLASS BD.CLASS A CLASS B CLASS B CLASS B
考题
若有如下程序:includeusing namespace std;int s=O;class sample{static int n;publi
若有如下程序: #include<iostream> using namespace std; int s=O; class sample { static int n; public: sample(int i) { n=i; } static void add() { s+=n; } }; int sample::s=0; int main() { sample a(2),b(5); sample::add(); cout<<S<<end1; return 0; } 程序运行后的输出结果是A.2B.5C.7D.3
考题
下面程序的结果为 include int c; class A { private: int a; static int b; publi
下面程序的结果为#include<iostream.h>int c;class A{private:int a;static int b;public:A( ) {a=0;c=0;}void seta( ) {a++;}void setb( ) {b++;}void setc( ) {c++;}void display( ) {cout < < a < < " " < < b < < " " < < c;}};int A: :b=0;void main( ){A a1,a2;a1.seta( ) ;a1.setb( ) ;al .setc( ) ;a2.seta( ) ;a2.setb( ) ;a2.setc( ) ;a2.display( ) ;}A.1 2 1B.1 2 2C.1 1 2D.2 2 2
考题
有以下程序:include using namespace std;int s=0;class sample{ static int n;publi
有以下程序: #include <iostream> using namespace std; int s=0; class sample { static int n; public: sample (int i) { n=i; } static void add() { s+=n; } }; int sample::n=0;A.2B.5C.7D.3
考题
The IP address 192.168.100.1 belongs to which class of IP address space?()
A. Class AB. Class BC. Class CD. Class D
考题
下面程序输出的结果为 #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 BB.CLASS A CLASS B CLASS A CLASS BC.CLASS A CLASS B CLASS BD.CLASS A CLASS B
考题
下面程序输出的结果为( )。 #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 BB.CLASS A CLASS B CLASS BC.CLASS A ClASS BD.CLASS A CLASS B CLASS A CLASS B CLASS B CLASS B
考题
下面程序的结果是 include class test{private: int num; publi
下面程序的结果是 #include<iostream.h> class test{ private: int num; public: test( ); int getint( ) {return num;} ~test( );}; test::test( ) { num=0;} test::~test( ) { cout<<"Destructor is active"<<endl;} voidA.Exiting main Destructor is active Destructor is active Destructor is activeB.Exiting main Destructor is active Destructoris activeC.Exiting main Destructoris activeD.Exiting main
考题
若有如下程序:includeusing namespace std;int s=0;class sample{static int n;publi
若有如下程序: #include<iostream> using namespace std; int s=0; class sample { static int n; public: sample(int i) { n=i; } static void add() { S+=n; } }; int sample::n=0; int main() { sample a(2),b(5); sample::add(); cout<<s<<endl; return 0; } 程序运行后的输出结果是( )。A.2B.5C.7D.3
考题
对于下面( )类定义,可以通过“newJ_Class()”生成类J_Class的实例对象。A、publicclassJ_Class{publicJ_Class(void){}}B、publicclassJ_Class{}C、publicclassJ_Class{publicJ_Class(Strings){}}D、publicclassJ_Class{publicvoidJ_Class(){}publicJ_Class(Strings){}
考题
Which statement is NOT true concerning the stowage of class 1 explosives ________.A.Class 1.1 explosives may be stowed with class 9 dangerous substancesB.Class 1.4 explosives must be“separated from”a stow of class 5.1 oxidizing materialsC.Class 1.4 explosives may not be stowed in the same hold with class 6.1 poisonsD.Class 1.4 explosives must be“separated from”a stow of class 8 corrosive materials
考题
Which class of Cisco access points operate under IEEE 802.3af power?()A、Class AB、Class 1C、Class 2D、Class 3E、Class 4
考题
In which two cases does the compiler supply a default constructor for class A?() A、 class A{}B、 class A { public A(){} }C、 class A { public A(int x){} }D、 class Z {} class A extends Z { void A(){} }
考题
Which declaration prevents creating a subclass of an outer class?()A、 Static class FooBar{}B、 Private class FooBar{}C、 Abstract public class FooBar{}D、 Final public class FooBar{}E、 Final abstract class FooBar{}
考题
根据栅格系统的标准用法,错误的是()A、div class="container"brdiv class="row" B、div class="row"brdiv class="col-md-1" C、div class="row"brdiv class="container" D、div class="col-md-1"brdiv class= "row"
考题
关于嵌套列的用法,错误的是()A、div class=“row”brdiv class=“col-sm-1”B、div class=“col-sm-1”brdiv class=“row”br C、div class=“row”brdiv class=“container”brdiv class=“col-xs-1”br D、div class=“container”brdiv class=“row”brdiv class=“col-xs-1”
考题
Which of the following class addresses is reserved for multicast?()A、 Class AB、 Class BC、 Class CD、 Class D
考题
Which of the following class networks contains 65,534 hosts?()A、Class AB、Class BC、Class CD、Class D
考题
What produces a compiler error?() A、 class A { public A(int x) {} }B、 class A {} class B extends A { B() {} }C、 class A { A() {} } class B { public B() {} }D、 class Z { public Z(int) {} } class A extends Z {}
考题
单选题What produces a compiler error?()A
class A { public A(int x) {} }B
class A {} class B extends A { B() {} }C
class A { A() {} } class B { public B() {} }D
class Z { public Z(int) {} } class A extends Z {}
考题
单选题已知接入Internet网的计算机用户名为Xinhua,而连接的服务商主机名为public.tpt.fj.cn,相应的E-mail地址应为( )。A
Xinhua@publi.tpt.fi.cnB
Xinhua.publi.tpt.fj.cnC
Xinhua.publi.@tpt.fj.cnD
Publi.tpt.fj.cn@Xinhua
热门标签
最新试卷