【单选题】设Point为已定义的类,下面声明Point对象a语句正确的是()
A. Point a=Point(); B. public Point a; C. Point a=new Point(); D. public Point a=new Point();
A. Point a=Point(); B. public Point a; C. Point a=new Point(); D. public Point a=new Point();
举一反三
- 下面定义结构体数组的代码段正确的是()。 A: struct POINT{ public double x;//横坐标 public double y;//纵坐标}POINT[] p;p=new POINT[100]; B: struct POINT{ public double x;//横坐标 public double y;//纵坐标}POINT p[100]; C: struct POINT{ public double x;//横坐标 public double y;//纵坐标}POINT p[]=new POINT[100]; D: struct POINT{ public double x;//横坐标 public double y;//纵坐标}POINT p=new POINT[100];
- 【单选题】若有语句 int *point,a=4; 和 point=&a; 下面均代表地址的一组选项是 A. a,point,*&a B. &*a,&a,*point C. *&point,*point,&a D. &a,&*point ,point
- 根据语句Point p = new Point( );可知Point类至少显式申明了一个构造方法。( )
- 下列代码中: class Point{ int x,y; public: Point(int a, int b=0); //① Point(Point &aPoint); //②Point(Point *p); //③ 默认的构造函数是 A: ① B: ② C: ③ D: 没有
- 8.5 阅读程序,写出运行结果 class Point{ int x=1; static int y=2; public void show(){System.out.println(x+","+y); }} public class tempDemo{ public static void main(String []args){ Point p1=new Point();p1.show(); p1.x=2;p1.y=3; Point p2=new Point();p2.show(); p1.show(); p1.y=5; p2.show(); }}