单项选择题
Given the uncompleted code of a class:
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) {
// doing the same as two arguments version of constructor
// including assignment name=n,age=a department = d;
}
}
Which expression can be added at the "doing the same as..." part of the constructor?()
A. Person(n,a);
B. this(Person(n,a));
C. this(n,a);
D. this(name,age);
相关考题
-
单项选择题
Whichofthefollowingassignmentisnotcorrect?()
A. float f = 11.1;
B. double d = 5.3E12;
C. double d = 3.14159;
D. double d = 3.14;. -
单项选择题
Whichstatementsaboutthegarbagecollectionaretrue?()
A. The program developer must create a thread to be responsible for free the memory.
B. The garbage collection will check for and free memory no longer needed.
C. The garbage collection allow the program developer to explicity and immediately free the memory.
D. The garbage collection can free the memory used java object at expect time. -
单项选择题
Given the following expression about TextField which use a proportional pitch font. TextField t = new TextField("they are good",40); Which statement is true?()
A. The displayed string can use multiple fonts.
B. The maximum number of characters in a line will be 40.
C. The displayed width is exactly 40 characters.
D. The user can edit the characters.
