类MyDate定义如下: class MyDate{ int year=2019, month=5, day=30; { year=2017; month=1; day = 1; } MyDate(int year, int month, int day){this.year=year; this.month=month; this.day=day;} MyData(){this(2018,12,31);} }; 执行语句 MyDate adate=new MyDate(); adate.year、adate.month、adate.day的值为_____________。
A: 2019 5 30
B: 2017 1 1
C: 2018 12 31
D: 不确定不确定不确定
A: 2019 5 30
B: 2017 1 1
C: 2018 12 31
D: 不确定不确定不确定
举一反三
- 程序:class Birthday{int year;int month;int day;public Birthday(int year,int month,int day){year = year; month = month; day = day;}public static void main(String[] args){Birthday birth = new Birthday(1980,10,22); System.out.println(year);}}程序运行后的输出是哪项? A: 1980 B: 10 C: 22 D: 0 E: 编译出错
- 有以下程序: Class Date { public: Date(int y,int m,mt d); { year=y; month=m; day=d; } Date(int y=2000) { year=y; month=10; day=1; } Date(Date &D) { year=d.year; month=d.month; day=d.day; } Void prin A: 2 B: 3 C: 4 D: 5
- 以下结构体数组定义,不正确的是______。 A: struct date{ int year; int month; int day;}date1[10],date2[10]; B: struct{ int year; int month; int day;}date1[10],date2[10]; C: struct date{ int year; int month; int day;}; ..... struct datedate1[10],date2[10]; D: struct datedate1[10],date2[10];.....struct date{ int year; int month; int day;};
- 下列有关结构体的定义错误的是_______。 A: typedef date { int year,month,day ;} type_date; B: struct { char name[10] ; float angle ;}; C: typedef struct date { int year,month,day ;} type_date ; D: struct date { int year,month,day ;} type_date ;
- 下面结构体的定义语句中,不正确的是______。 A: structdate B: int month; C: int day; D: int year; E: Struct date datel; F: B.stmctdate G: intmonth; H: int day; I: int year; J: datel; K: struct L: int month; M: int day; N: int year; O: date 1; P: D. #define DATE stmct date Q: DATE R: int month; S: int day; T: int year; U: datel;