Consider the following class definitions.public class BClass{    private int x;    public void set(int a)     {        x = a;    }    public void print()    {        System.out.print(x);    }}public class DClass extends BClass{    private int y;    public void set(int a, int b)     {         //Postcondition: x = a; y = b;    }    public void print(){ }}
Which of the following correctly redefines the method print of DClass?(i)   public void print()   {      System.out.print(x + " " + y);   }(ii)    public void print()   {      super.print();      System.out.print(" " + y);   }

A. Only (i)     
B. Only (ii)
C. Both (i) and (ii)
D. None of these


Answer: B

Computer Science & Information Technology

You might also like to view...

When you no longer need to use an RSS feed, you should ____________________ it so that you do not have unwanted messages in your account.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Which Windows Server 2016 feature allows a user to utilize a software environment in which an application can run but is isolated from much of the rest of the operating system and other applications?

A. Hyper-V B. Storage Spaces C. Windows Containers D. Nano Server

Computer Science & Information Technology

If you want the results of a query to display only those records that meet all criteria, you would use the ________ operator.

A. OR B. NOT C. AND D. NOR

Computer Science & Information Technology

The text in a flyer is organized into three areas. List all three and briefly describe each.

What will be an ideal response?

Computer Science & Information Technology