单项选择题
class Parent {
String one, two;
public Parent(String a, String b){
one = a;
two = b; }
public void print(){ System.out.println(one); } }
public class Child extends Parent {
public Child(String a, String b){
super(a,b);
}
public void print(){
System.out.println(one + " to " + two);
}
public static void main(String arg[]){
Parent p = new Parent("south", "north");
Parent t = new Child("east", "west");
p.print();
t.print();
}
}
Which of the following is correct?()
A. Cause error during compilation.
B. south east
C. south to north east to west
D. south to north east
E. south east to west
相关考题
-
多项选择题
public class Parent { int change() {…} } class Child extends Parent { } Which methods can be added into class Child?()
A. public int change(){}
B. int chang(int i){}
C. private int change(){}
D. abstract int chang(){} -
多项选择题
Whichofthefollowingstatementsarelegal?()
A. long l = 4990;
B. int i = 4L;
C. float f = 1.1;
D. double d = 34.4;
E. double t = 0.9F; -
多项选择题
String s= "hello"; String t = "hello"; char c[] = {’h’,’e’,’l’,’l’,’o’} ; Which return true?()
A. s.equals(t);
B. t.equals(c);
C. s==t;
D. t.equals(new String("hello"));
E. t==c;
