A.int addValue (int a,intB){//do something...}
B.public void addValue() {//do something...}
C.public int addValue (int a,intB)throws MyException {//do something...}
D.public float addValue (int a,int b,float b=1.0) {//do someting...}
[单选题]有如下程序:class Base{public:int data;};class Derived1:public Base{};class Derived2:protected Base{};int main(){D.erived1 d1;D.erived2 d2;d1. data=0; //①d2. data=0; //②return 0;}下列关于程序编译结果的描述中,正确的是( )。A.) ①②皆无编译错误B.) ①有编译错误,②无编译错误C.) ①无编译错误,②有编译错误D.) ①②皆有
[单选题]有如下程序; public class MethTest { static int Varl=100; int Var2=200; public static void main(String args[]) { Varl=10; MethTest Obj1=new MethTest(); MethTest Obj2=new MethTest(); Obj1.Varl++; System.out.println(Objl.Varl); Obj2.Varl++; System.out.printl
[单选题]有如下程序 public class Test { int a,b; Test ( ) { a = 100; b = 200; } Test(int x, int y) { a = x; b = y; } public static void main(String args[]) { Test Obj1 = new Test(12,45); System.out.println("a = "Obj1.a+" b = "+ObB) ; Test Obj1 = new Test(); Sy
[单选题]设有如下程序:include class A{public:int i;display(){ cout<<"class A/n"; }};c设有如下程序:#include <iostream. h>class A{public:int i;display(){ cout<<"class A/n"; }};class B{public:int i;display(){ cout<<"class B/n"; }};class C: public: A, public: B{int j;p
[单选题]有如下程序: public class MethLoad { public static void main(String args[]) { MethLoad classObj=new MethLoad(); classObj.methtest(4); classObj.methtest(0); } void methtest(double d) { double sum=2*d; System.out.println("The result is:"+sum); } void metht
[单选题]有如下程序: public class Sun { public static void main(String args[ ]) { int s=0; int i=1; while (i<=100) { s=s+i; } System.out.println(s); } } 运行后的结果是( )。A.5050B.5051C.死循环,直到溢出D.无穷大的数
[主观题]若有如下程序:public class Test {public static void main (String[] args) {int x=20;if (x>10) System.out.print(x-=5);if (x>5) System.out.print(x--);}}则程序运行后的输出结果是[ ]。
[单选题]有如下程序 public class Sun { public static void main(String args[ ]) { int x=1,a=0,b=0; switch(x) { case 0:b++; case 1:a++; case 2: a++; b++; } System.out.println("a="+a+","+"b="+B) } }该程序的输出结果是( )。A.a=2,b=1B.a=1,b=1C.a=1,b=0D.a=0,b=0
[单选题]有如下程序: public class Sun { public static void main(String args[ ]) { int s=0; int i=1; while(i<=100) { s=s+i; } System.out.println(s); } } 运行后的结果是( )。A.5050B.5051C.死循环,直到溢出D.无穷大的数
[单选题]有如下程序 public class Sun { public static void main(String args[ ]) { int a=2,b=1,c=2; if(a<B) if(b<0) if(c<0) c=0; else C++; System.out.println(C) ; } } 上述程序的运行结果是( )。A.0B.1C.2D.3