Given the following code, write a line of code that, when in

题目
填空题
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.()
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Given:Under which three circumstances will the code on line 37 be executed?()

A.The instance gets garbage collected.

B.The code on line 33 throws an exception.

C.The code on line 35 throws an exception.

D.The code on line 31 throws an exception.

E.The code on line 33 executes successfully.


参考答案:B, C, E

第2题:

Click the Exhibit button. Given:Which two statements are true if a NullPointerException is thrown on line 3 of class C? ()

A.The application will crash.

B.The code on line 29 will be executed.

C.The code on line 5 of class A will execute.

D.The code on line 5 of class B will execute.

E.The exception will be propagated back to line 27.


参考答案:B, E

第3题:

Given:What is the result when the programmer attempts to compile the code and run it with the command java Converter 12?()

A. It is true that j==i.

B. It is false that j==i.

C. An exception is thrown at runtime.

D. Compilation fails because of an error in line 13.


参考答案:D

第4题:

31. // some code here  32. try {  33. // some code here  34. } catch (SomeException se) {  35. // some code here  36. } finally {  37. // some code here  38. }  Under which three circumstances will the code on line 37 be executed?()

  • A、 The instance gets garbage collected.
  • B、 The code on line 33 throws an exception.
  • C、 The code on line 35 throws an exception.
  • D、 The code on line 31 throws an exception.
  • E、 The code on line 33 executes successfully.

正确答案:B,C,E

第5题:

Given:Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()

A.Point p = Line.getPoint();

B.Line.Point p = Line.getPoint();

C.Point p = (new Line()).getPoint();

D.Line.Point p = (new Line()).getPoint();


参考答案:D

第6题:

Given:Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()

A.move the line 12 print statement into the foo() method

B.change line 7 to public synchronized void go() {

C.change the variable declaration on line 2 to private volatile int x;

D.wrap the code inside the foo() method with a synchronized( this ) block

E.wrap the for loop code inside the go() method with a synchronized block synchronized(this){ //for loop code here }


参考答案:A, D

第7题:

Given:Which code fragment, inserted at line 23, allows the code to compile?()

A.df = new DateFormat();

B.df = Date.getFormat();

C.df = date.getFormat();

D.df = DateFormat.getFormat();

E.df = DateFormat.getInstance();


参考答案:E

第8题:

Given:Which three methods, inserted individually at line 14, will correctly complete class Two?()

A.int foo() { /* more code here */ }

B.void foo() { /* more code here */ }

C.public void foo() { /* more code here */ }

D.private void foo() { /* more code here */ }

E.protected void foo() { /* more code here */ }


参考答案:B, C, E

第9题:

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a page that contains the following code fragment:       You write the following code segment in the code-behind file for the page:   void BindData(object sender, EventArgs e) {   lstLanguages.DataSource =  CultureInfo.GetCultures(CultureTypes.AllCultures);   lstLanguages.DataTextField = "EnglishName";  lstLanguages.DataBind();   }   You need to ensure that the lstLanguages ListBox control maintains the selection of the user during postback.  Which line of code should you insert in the constructor of the page?()

  • A、this.Init += new EventHandler(BindData); 
  • B、this.PreRender += new EventHandler(BindData); 
  • C、lstLanguages.PreRender += new EventHandler(BindData); 
  • D、lstLanguages.SelectedIndexChanged += new EventHandler(BindData);

正确答案:A

第10题:

Write a line of code that declares a variable named layout of type LayoutManager and initializes it with a new object, which when used with a container can lay out components in a rectangular grid of equal-sized rectangles, 3 components wide and 2 components high.()


正确答案:layout = new GridLayout(2, 3);"   or: "LayoutManager layout = new

更多相关问题