网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
1.publicclassa{
2.publicvoidmethod1(){
3.try{
4.Bb=newb();
5.b.method2();
6.//morecodehere
7.}catch(TestExceptionte){
8.thrownewRuntimeException(te);
9.}
10.}
11.}
1.publicclassb{
2.publicvoidmethod2()throwsTestException{
3.//morecodehere
4.}
5.}
1.publicclassTestExceptionextendsException{
2.}
Given:
31.publicvoidmethod(){
32.Aa=newa();
33.a.method1();
34.}
WhichistrueifaTestExceptionisthrownonline3ofclassb?()
参考答案
更多 “ 1.publicclassa{2.publicvoidmethod1(){3.try{4.Bb=newb();5.b.method2();6.//morecodehere7.}catch(TestExceptionte){8.thrownewRuntimeException(te);9.}10.}11.}1.publicclassb{2.publicvoidmethod2()throwsTestException{3.//morecodehere4.}5.}1.publicclassTestExceptionextendsException{2.}Given:31.publicvoidmethod(){32.Aa=newa();33.a.method1();34.}WhichistrueifaTestExceptionisthrownonline3ofclassb?() ” 相关考题
考题
下列语句输出结果为 。public class A{public static void main(String[]args){byte b=0xa;System.out.println(b);}}()
A.0xaB.aC.1D.10
考题
根据下面的代码,可以确定类A与类B之间存在()关系。publicclassA{privateBtheB;publicvoidaMethod(){theB.doSomthing();}}
A、关联B、泛化C、实现D、包含
考题
publicclassSomeException{}Classa:publicclassa{publicvoiddoSomething(){}}Classb:publicclassbextendsa{publicvoiddoSomething()throwsSomeException{}}Whichistrueaboutthetwoclasses?()
A.Compilationofbothclasseswillfail.B.Compilationofbothclasseswillsucceed.C.Compilationofclassawillfail.Compilationofclassbwillsucceed.D.Compilationofclassawillfail.Compilationofclassawillsucceed.
考题
publicclassA{2.publicvoiddoit(){3.}4.publicStringdoit(){5.returna”;6.}7.publicdoubledoit(intx){8.return1.0;9.}10.}Whatistheresult?()
A.Anexceptionisthrownatruntime.B.Compilationfailsbecauseofanerrorinline7.C.Compilationfailsbecauseofanerrorinline4.D.CompilationsucceedsandnoruntimeerrorswithclassAoccur.
考题
publicclassA{2.voidA(){3.System.out.println(ClassA”);4.}5.publicstaticvoidmain(String[]args){6.newA();7.}8.}Whatistheresult?()
A.ClassAB.Compilationfails.C.Anexceptionisthrownatline2.D.Anexceptionisthrownatline6.E.Thecodeexecuteswithnooutput.
考题
【单选题】下面程序段的输出结果是() 。 public class A{ public static void main(String args[]) { String str ="Hello,"; str=str+"Guys!"; System.out.println(str); } }A.hello,guys!B.hello,C.guys!D.编译不通过
考题
23、假定类A已经定义,对于以A为基类的单一继承类B,以下定义中正确的是:()A.class B:public A{//...};B.class A:public B{//...};C.class B:public class A{//...};D.class A:class B public{//...};
考题
下面的代码使用了面向对象的什么特性?() public class A{ public void DoSomething(){} } public class B : A{ new public void DoSomething(){ base.DoSomething();} }A.继承性B.多态性C.封装性D.关联性
考题
下列哪些是合法的类定义语句A.public class A {}B.class A extends Exception,I0Exception {}C.public class 1A extends ObjectD.public class String {}
考题
若要使用两个泛型类型来声明一个名为A的类,请使用A.public class A<E> { ... }B.public class A<E, F> { ... }C.public class A(E) { ... }D.public class A(E, F) { ... }
热门标签
最新试卷