题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-18 16:54:09

[单项选择]有如下程序;
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.println(Obj2.Varl);
MethTest.Varl++;
System.out.println(Objl.Varl);
Obj1.Var2++;
System.out.println(Obj1.Var2);
Obj2.Var2++;
System.out.println(Obj2.Var2);


程序的运行结果为( )。
A. 11
B. 101
C. 11
D. 10

更多"有如下程序; public class MethTest "的相关试题:

[单项选择]有如下程序; 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.println(Obj2.Varl); MethTest.Varl++; System.out.println(Objl.Varl); Obj1.Var2++; System.out.println(Obj1.Var2); Obj2.Var2++; System.out.println(Obj2.Var2); } } 程序的运行结果为( )。
A. 11 12 13 201 201
B. 101 102 103 201 201
C. 11 12 13 201 202
D. 10 10 10 201 201
[单项选择]有如下程序
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 = "+Ob31.B) ;
Test Obj1 = new Test( );
System.out.println("a = "Obj1.a+" b = "+Obj1.B) ;


程序的运行结果为( )。
A. a=100 b=200
B. a=12 b=45
C. a=12 b=200
D. a=100 b=45
[单项选择]下面程序的运行结果为( )。
class A
static int n;
public:
A( )n=1;
A(int num)n=num;
void print( )cout<<n;

A::n=0;
void main( )
A a,b(2);
a.print( );
b.pint( );

A. 12
B. 11
C. 22
D. 21
[单项选择]若有如下程序:
sub(int x)
int y=0; static int z=1;
y+=x+2;z+=y+x;
return(z);
main( )
int t=1,n;
for(n=0;n<3;n++)printf("%d,",sub(t));
则程序运行后的输出结果是 ( )
A. 5,5,5
B. 5,9,13,
C. 5,7,9,
D. 5,8,11,
[填空题]阅读并完成程序。
public class Class27

int m,n;
public______
public______m=a;
public static void main(String args[])

Class27 t1,t2;
int j=0;
t1=new Class27( );
t2=new Class27(j);


[简答题]

阅读下列程序,请写出该程序的输出结果。
class Test33 {
static int merger(int [] a, int []b, int []c){
int i = 0, j = 0, k = 0;
while(i < a.length && j < b.length) {
if(a[i] < b[j])c[k++] = a[i++];
else c[k++] = b[j++];
}
while(i < a.length) c[k++] = a[i++];
while(j < b.length) c[k++] = b[j++];
return k;
}
public static void main(String[] args) {
int a[] = {3, 6, 9};
int b[] = { 1, 2, 5};
int []c = new int[100];
int p = merger(a, b, c);
for(int k = 0; k < p; k++)
System.out.print(c[k]+ (k < p-1 " ":"/n"));
}


[单项选择]有如下类定义:
class AA

int a;
public :
int getRef( )const t return &a; //①
int getValue( )const return a; //②
void set(int n)const a=n; //③
friend void show(AA aa)const cout <<a; //④
;
其中四个函数的定义中正确的是( )。
A. ①
B. ②
C. ③
D. ④
[单项选择]有如下类定义:
class AA

int a;
public:
    int getRef( )constreturn &a; //①
    int getValue( )constreturn a;) //②
    void set(int n)consta=n; //③
    friend void show(AAaa)constcout<<a; //④
;
其中的四个函数定义中正确的是
A. ①
B. ②
C. ③
D. ④
[单项选择]有如下程序段:
public class Parent
public int addValue (int a,int b)
int s;
s=a+b;
return 3;


class Child extends Parent
则下列选项中,可以正确加入类Child中且父类的方法不会被覆盖的是( )。
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 MyClass

int i;
private: int j;
protected: int k;
public:int m,n;
;
其中,私有成员的数量为______。
[单项选择]有如下头文件:
int fl0;
static int f2( );
class MA
public:
int f30;
static int f4( );
;
在所描述的函数中,具有隐含的this指针的是( )。
A. f1
B. f2
C. f3
D. f4
[单项选择]有如下类定义:
class XX
int xdata:
public:
xx(int n=0):xdata(n)

class YY:public XX
int ydata;
public:
YY(int m=0,int n=0):xx(m),ydata(n)

YY类的对象包含的数据成员的个数是
A. 1
B. 2
C. 3
D. 4
[单项选择]有如下程序
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=1
B. a=1,b=1
C. a=1,b=0
D. a=0,b=0
[单项选择]有如下程序:
public class MethLoad

public static void main(String args[])

MethLoad classObj = new MethLoad( );
classObj.methtest(4);
classObj.methtest(4.0);

void methtest(double D)

double sum = 2*d;
System.out.println("The result is:"+sum);

void methtest(int n)

int sum = 4*n;
System.out.println("The result is:"+sum);


程序的运行结果为( )。
A. The result is:16
B. The result is:8.0
C. The result is:8
D. The resuR is:16.0

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码