填空题
Given the following code, write a line of code that, when inserted at the indicated location, will make the overriding method in Extension invoke the overridden method in class Base on the current object.
class Base {
public void print() {
System.out.println("base");
}
}
class Extention extends Base {
public void print() {
System.out.println("extension");
// insert line of implementation here
}
}
public class Q294d {
public static void main(String args[]) {
Extention ext = new Extention();
ext.print();
}
}
Fill in a single line of implementation.()
super.print();
相关考题
-
单项选择题
Whichstatementsaretrue,giventhecodenewFileOutputStream("data",true)forcreatinganobjectofclassFileOutputStream?()
A.FileOutputStream has no constructors matching the given arguments.
B.An IOExeception will be thrown if a file named "data" already exists.
C.An IOExeception will be thrown if a file named "data" does not already exist.
D.If a file named "data" exists, its contents will be reset and overwritten.
E.If a file named "data" exists, output will be appended to its current contents. -
多项选择题
WhichstatementsconcerningtheeventmodeloftheAWTaretrue?()
A.At most one listener of each type can be registered with a component.
B.Mouse motion listeners can be registered on a List instance.
C.There exists a class named ContainerEvent in package java.awt.event.
D.There exists a class named MouseMotionEvent in package java.awt.event.
E.There exists a class named ActionAdapter in package java.awt.event. -
单项选择题
What will be the appearance of an applet with the following init() method? public void init() { add(new Button("hello")); }
A.Nothing appears in the applet.
B.A button will cover the whole area of the applet.
C.A button will appear in the top left corner of the applet.
D.A button will appear, centered in the top region of the applet.
E.A button will appear in the center of the applet.
