题目内容

现有以下现实中的关系,请问哪个代码能正确体现这个关系?店员(Employee)是一个人(Person),一个店员负责招待一个或多个客人(Dependants)。

A. class Employee extends Dependants{ Person p;}
B. class Person extends Employee{ Vector dependants;}
C. class Employee extends Person{ Vector dependants;}
D. abstract class Person extends Dependants{Employee e;}
E. class Dependant implements Employee{Vector person;}

查看答案
更多问题

给出以下代码,请问该程序的运行结果是什么?class Example{ public static void main(String [] args){ boolean b=true; System.out.println(b); } }

A. 打印输出true。
B. 打印输出1。
C. 编译错误,因为System.out.println()方法的参数只能为整数。
D. 无内容输出。
E. 编译错误,如果把true改变为TRUE,则可使代码编译通过。

给出以下代码,请问该程序的运行结果是什么?class Example{public static void main(String [] args){char[] c=new char[100];System.out.println(c[50]);}}

A. 打印输出50
B. 打印输出49
C. 打印输出\u0000
D. 打印输出\u0020
E. 打印输出空白行
F. 输出内容无法确定
G. 打印输出null

给出以下代码,请问插入那条语句后可以依次打印输出数组中的每行元素的数目?class Example{public static void main(String [] args){int arr[][]=new int[4][];arr[0]=new int[4];arr[1]=new int[3];arr[2]=new int[2];arr[3]=new int[1];for(int n=0;n<4;n++)System.out.println(/*插入语句处*/);}}

A. arr[n].length();
B. arr.size;
C. arr.size-1;
D. arr[n][size];
E. arr[n].length;

给出发下代码,请问该程序的运行结果是什么?class Example{public static void main(String [] args){int [] a={1,2,3,4,5};System.out.println(a[3]);}}

A. 1
B. 2
C. 3
D. 4

答案查题题库