题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-07-05 04:58:20

[简答题]class point
private:
int x,y;
public:
point(int,int);
point(point&);

point::point(int a,int b)

x=a;
______=b;

point::point(______)

x=z.x;
y=z.y;

void main( )
point p1(2,3);
point p2(p1);

更多"class point private: int x,y"的相关试题:

[单项选择]有以下类定义:
class Point
public:
Point(int x=0,int y=0)_x=x; _y=y;
void Move(int x Off, int y Off)
_x+=x Off; _y+=y Off;
void Print( ) const

cout <<’(’ << _x << ’,’ << _y << ’)’<< end 1;
private:
int _x,_y;

下列语句中会发生编译错误的是______。
A. Point pt; pr. Print();
B. const Point pt; pt. Print();
C. Point pt; pt. Move(1,2);
D. const Point pt; pt. Move(1,2);
[填空题]#inelude<iostream.h>
class point
int x;
public:
void init(int a)x=a;
int getx( )return x;
void setx(int a)x=a;

void main( )
point a;
a.init(20,30);
cout<<a.getx( )<<endl;

[单项选择]有如下程序
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
[单项选择]下面程序段的输出结果为
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="+Obj1.B) ;
Test Obj2=new Test( );
System.out.println("="+Obj2.a+" b="+Obj2.B) ;


A. a=100 b=200
B. a=12 b=45
C. a=12 b=200
D. a=100 b=45
[单项选择]下面程序段的输出结果为
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 Objl=new Test(12,45);
System.out.println("a="+objl.a+" b="+Objl.b);
Test Obj2=new Test( );
System.out.println("a="+Obj2.a+" b="+Obj2.b);


A. a=100 b=200
B. a=12 b=45
C. a=12 b=200
D. a=100 b=45
[单项选择]下列程序段的输出结果是______。
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="+Obj1.B);
Test Obj2=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
[填空题]阅读并完成程序。
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);


[单项选择]下面程序段的输出结果为( )。
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="+Obj1.b);
Test Obj2=new Test( );
System.out.println("a="+Obj2.a+"b="+Obj2.b);


A. a=100 b=200
B. a=12 b=45
C. a=12 b=200
D. a=100 b=45
[填空题]按注释完成程序
public class Leaf
private int i = 0; //此属性值用于检验
Leaf increment( ) //定义方法increment( ),返回值是Leaf类的对象
i++;
return (1) ;//将当前对象的地址作为返回值返回

void print( )
System.out.println(" i = " + i);

public static void main(String args[])
Leaf x = (2); //创建Leaf类的对象x
x.increment( ).increment( ).increment( ).print( );
//多次调用方法increment( ),返回的都是x的地址,i 值表示调用次数

输出结果为 i = (3)
[填空题]下列程序的运行结果是______。
public class MyClass
int a[] = 1, 2, 3, 4, 5 ;
void out______
for (int j = 0; j < a.length; j++)
System.out.print(a[j] + "");

public static void main(String[] args)
MyClass my = new MyClass______;
my.out______;


[简答题]阅读下列程序,请写出该程序的输出结果。
public class C

int x=10;
static int y=20;
public static void main(String[] args)

C obj1=new C( );
C obj2=new C( );
obj1.x*=2;
obj1.y*=3;
obj2.x+=4;
obj2.y+=5;
System. out. println(obj1.x);
System. out. println(obj1.y);
System. out. println(obj2.x);
System. out. println(obj2.y);


[单项选择]有如下程序段:
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...

我来回答:

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

订单号:

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