10.publicclassFooimplementsjava.io.Serializable{11.privateintx;12.publicintgetX(){returnx;}12.publicFoo(intx){this.x=x;}13.privatevoidwriteObject(ObjectOutputStreams)14.throwsIOException{15.//insertcodehere16.}17.}Whichcodefragment,insertedatline15,willallowFooobjectstobecorrectlyserializedanddeserialized?()A.s.writeInt(x);B.s.serialize(x);C.s.writeObject(x);D.s.defaultWriteObject();
10.publicclassFooimplementsjava.io.Serializable{11.privateintx;12.publicintgetX(){returnx;}12.publicFoo(intx){this.x=x;}13.privatevoidwriteObject(ObjectOutputStreams)14.throwsIOException{15.//insertcodehere16.}17.}Whichcodefragment,insertedatline15,willallowFooobjectstobecorrectlyserializedanddeserialized?()
A.s.writeInt(x);
B.s.serialize(x);
C.s.writeObject(x);
D.s.defaultWriteObject();
相关考题:
下面的函数模板定义中错误的是A.templateB.template Q F(Q x){retum Q+x;) Q F(Q x){return x+x;}C.template<classT>D.template<class T> TF(T x){return x*x;) Bool F(tx){return x>1;)
下列函数模板的定义中,合法的是A.template T abs(T x){return x 下列函数模板的定义中,合法的是A.template <typename T> T abs(T x){return x<0?-x:x;}B.template class <T> T abs(T x){return x<0?-x:x;}C.template T<class T>abs(T x){return x<0?-x:x;}D.template T abs(T x){return x<0?-x:x;}
10.classInner{11.privateintx;12.publicvoidsetX(intx){this.x=x;}13.publicintgetX(){returnx;}14.}15.16.classOuter{17.privateInnery;18.publicvoidsetY(Innery){this.y=y;}19.publicInnergetY(){returny;}20.}21.22.publicclassGamma{23.publicstaticvoidmain(String[]args){24.Outero=newOuter();25.Inneri=newInner();26.intn=10;27.i.setX(n);28.o.setY(i);29.//insertcodehere30.System.out.println(o.getY().getX());31.}32.}Whichthreecodefragments,addedindividuallyatline29,producetheoutput100?()
1.classBaseClass{2.privatefloatx=1.of;3.protectedfloatgetVar(){returnx;}4.}5.classSubClassextendsBaseClass{6.privatefloatx=2.Of;7.//insertcodehere8.}Whichtwoarevalidexamplesofmethodoverridingwheninsertedatline7?()A.floatgetVar(){returnx;}B.publicfloatgetVar(){returnx;}C.publicdoublegetVar(){returnx;}D.protectedfloatgetVar(){returnx;}E.publicfloatgetVar(floatf){returnf;}
分析以下程序执行结果【】。 include int f (int x, int y){return x,y; } double f (d 分析以下程序执行结果【 】。include<iostream.h>int f (int x, int y){return x,y;}double f (double x, double y) {return x,y;}void main() {int a=4, b=6;double c=2.6, d=7.4;cout<<f (a, b) <<","<<f (c, d) <<end1;}
下列函数模板的定义中,合法的是( )。A.templatetypename TT abs(T X){return x07-x:X;}B.template ClassTT abs(T x){return x07-X:x;}C.template TClass Tabs(T X){return x07-x:X;}D.template T abs(T x){return X0?-X:x;}
下列模板定义中不正确的是A.emplate Q F(Q x){return Q+x;}B.template Q F(Q x){return x+x;}C.template T F(T x){return x * x;}D.template T F(T x){return x;}
21、下列函数模板的定义中,合法的是()。A.template <typename T> T abs(T x){return x<0?-x:x;}B.template class<T> T abs(T x){return x<0 ?-x:x;}C.template T<class T> abs(T x){return x<0 ?-x:x;}D.template T abs(T x){return x<0 ?-x:x;}
下列函数模板的定义中,合法的是()。A.template<typename T>T abs(T x){return x<0?-x:x;}B.template class<T>T abs(T x){return x<0 ?-x:x;}C.template T<class T> abs(T x){return x<0 ?-x:x;}D.template T abs(T x){return x<0 ?-x:x;}