单项选择题
给出下列的不完整的类代码,则下列的哪个语句可以加到横线处 class Person { String name,department; int age; public Person( String n ){ name = n;} public Person( String n,int a ) { name = n;age = a;} public Person( String n,String d,int a ) { _____________ department = d; } }
A.Person(n,;
B.this(Person(n, );
C.this(n,;
D.this(name,ag;
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
设有下列两个类的定义,则类Person和类Man的关系是 class Person { long id; 身份证号 String name; 姓名 } class Man extends Person { int age; 年龄 int getScore( ) { return score; } }
A.包含关系
B.继承关系
C.关联关系
D.无关系,上述类定义有语法错误
点击查看答案&解析
单项选择题
在下列源代码文件Test.java中,哪个选项是正确的类定义A)public class test{ public int x=0; public test(int x ) { this.x=x; } }B)public class Test { public int x=0; public Test(int x ) { this.x=x; } }C)public class Test extends T1 T2 { public int x=0; public Test(int x){ this.x=x; } }D)protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }
在下列源代码文件Test.java中,哪个选项是正确的类定义A)public class test{ public int x=0; public test(int x ) { this.x=x; } }B)public class Test { public int x=0; public Test(int x ) { this.x=x; } }C)public class Test extends T1 T2 { public int x=0; public Test(int x){ this.x=x; } }D)protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }
点击查看答案&解析
相关试题
在下列源代码文件Test.java中,哪个选项是...
下列哪个选项是main( )方法的返回值类型
在数据库设计中,将E-R图转换成关系数据模...
为了区分类中重载的同名的不同的方法,要求
软件设计包括软件的结构、数据接口和过程设...