1、以下变量申明语句,错误的是()。
A: int age;
B: final int age = 18;
C: int age = 18;
D: int age = 18.5;
A: int age;
B: final int age = 18;
C: int age = 18;
D: int age = 18.5;
举一反三
- 测一测(模块2_3)定义一个变量age,用来存放某位同学的年龄(假定年龄均为整数),则以下哪一项是正确的? A: String age;age=18; B: int age=18; C: char age=18; D: age=18;
- 下面哪个是不合法的Java注释。 A: *声明一个变量*/ int age = 20; B: ** 声明一个变量*/ int age = 20; C: int age = 20; -- 声明一个变量 D: int age = 20; // 声明一个变量
- 下列对结构类型变量不正确的定义是 A: struct teacher{ int num; int age; }teacher1; B: struct{ int num; int age; }teacher1,teacher2; C: struct{ int num; int age; }teacher D: struct teacher{ int num,age; }a;
- 已知:创建了一个Scanner类型的对象sc,下列语句正确的是() A: int age = sc.next(); B: int age = sc.nextShort(); C: int age = sc.nextByte(); D: double age = sc.nextDouble();
- 下列对结构体类型变量定义不正确的是( ) A: struct teacher { int num; int age; }teach1; B: struct { int num; int age; }teach1,teach2; C: struct { int num; int age; }teacher; struct teacher teach1; D: struct teacher { int num; int age; }; struct teacher teach1;