1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 25.A a=new A(); 26.System.out.println(a.doit(4,5)); What is the result?()
第1题:
A.classA{}
B.classA{publicA(){}}
C.classA{publicA(intx){}}
D.classZ{}classAextendsZ{voidA(){}}
第2题:
下面程序段的输出结果为( )。 package test; public class ClassA { int x=20: static int y=6; public static void main(String args[]) { ClassB b=new ClassB; go(10); System.out.println("x="+b.x); } } class ClassB { int X; void go(int y) { ClassA a=new ClassA; x=a.Y ; } }
A.x=10
B.x=20
C.x=6
D.编译不通过
第3题:
有如下模板声明:
template<typenameT1,typenameT2>classA;
下列声明中,与上述声明不等价的是( )。
A.template<classTl,classT2>classA;
B.template<classT1,typenameT2>classAt
C.template<typenameT1,classT2>classA;
D.template<typenameT1,T2>classA;
第4题:
下面程序输出的结果为( )。
#include"iostream.h"
classA
{public:
A(){cOUt<<"CLASSA"<<endl;}
~A(){}};
ClaSSB:publicA
{public:
B(){cout<<"CLASSB"<<endl;}
~B(){}};
voidmain()
{A*P;
P=newB:
B*q:
q=newB;}
A.CLASSB
B.CLASSA CLASSB CLASSB
C.CLASSA CLASSB CLASSA CLASSB
D.CLASSA CLASSB CLASSB CLASSB
第5题:
public class ClassA{ public int getValue(){ int value=0; boolean setting=true; String title="Hello"; if(value||(setting && title=="Hello")){return 1;} if(value==1&title.equals("Hello")){return 2;} } } And: ClassA a=new ClassA(); a.getValue(); What is the result?()
第6题:
()Chinese in your English class
第7题:
1.public class Test { 2.public static void main (String args[]) { 3.class Foo { 4.public int i = 3; 5.} 6.Object o = (Object) new Foo(); 7.Foo foo = (Foo)o; 8.System.out.printIn(foo. i); 9. } 10.} What is the result?()
第8题:
The code runs with no output.
Compilation fails.
An exception is thrown at runtime.
ClassC is displayed.
第9题:
420 is the output.
An exception is thrown at runtime.
All constructors must be declared public.
Constructors CANNOT use the private modifier.
Constructors CANNOT use the protected modifier.
第10题:
public
public static
private
virtual
第11题:
p0 = p1;
p1 = p2;
p2 = p4;
p2 = (ClassC)p1;
p1 = (ClassB)p3;
p2 = (ClassC)p4;
第12题:
1
2
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第13题:
A.Compilation fails.
B.ClassC is displayed.
C.The code runs with no output.
D.An exception is thrown at runtime.
第14题:
下面程序输出的结果为( )。 #include"iostream.h" classA {public: A(){cOUt<<"CLASSA"<<endl;} ~A(){}}; ClaSSB:publicA {public: B(){cout<<"CLASSB"<<endl;} ~B(){}}; voidmain() {A*P; P=newB: B*q: q=newB;}
A.CLASSA
B.CLASSA CLASSBCLASSB CLASSB
C.CLASSA
D.CLASSA CLASSBCLASSB CLASSACLASSB CLASSBCLASSB
第15题:
下列方法中,不属于类Strin9的方法是( )。
A.toLowerCase
B.valueOf
C.charAt
D.append
第16题:
10. public class ClassA { 11. public void count(int i) { 12. count(++i); 13. } 14. } And: 20. ClassA a = new ClassA(); 21. a.count(3); Which exception or error should be thrown by the virtual machine?()
第17题:
Given: class ClassA {} class ClassB extends ClassA {} class ClassC extends ClassA {} and: ClassA p0 = new ClassA(); ClassB p1 = new ClassB(); ClassC p2 = new ClassC(); ClassA p3 = new ClassB(); ClassA p4 = new ClassC(); Which three are valid?()
第18题:
1.public class test ( 2.public static void main (String args[]) { 3.int i = 0xFFFFFFF1; 4.int j = ~i; 5. 6.} 7.) What is the decimal value of j at line 5?()
第19题:
0
1
14
–15
An error at line 3 causes compilation to fail.
An error at line 4 causes compilation to fail.
第20题:
Line 26 prints a to System.out.
Line 26 prints b to System.out.
An exception is thrown at line 26 at runtime.
Compilation of class A will fail due to an error in line 6.
第21题:
第22题:
StackOverflowError
NullPointerException
NumberFormatException
IllegalArgumentException
ExceptionlnlnitializerError
第23题:
p0=pl;
p1 =p2;
p2=p4;
p2 = (ClassC)pl;
p1 = (ClassB)p3;
p2 = (Classc)p4;
第24题:
Compilation will fail.
Compilation will succeed and the program will print “3”
Compilation will succeed but the program will throw a ClassCastException at line 6.
Compilation will succeed but the program will throw a ClassCastException at line 7.