单项选择题
给出下列的不完整的类代码,则下列的哪个语句可以加到横线处 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; } }
点击查看答案&解析
相关试题
如果容器采用 【14】 进行布局管理,在...
setLayout( )方法是所有容器的父类 【...
【12】 类是提供线程操作和管理的类。
Java程序中定义接口所使用的关键字是 【1...
对象是一组相关变量和相关方法的封装体,是...