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...

The fuel-injection system in car engine uses a(n) ________ operating system

Fill in the blank(s) with correct word

Computer Science & Information Technology

Suppose you suspect that your session with a server has been intercepted in a man-in-the middle attack. You have a key, K, that you think you share with the server, but you might be only sharing it with an attacker. But the server also has a public key, KP , which is widely known, and a private secret key, KS, that goes with it. Describe how you can either confirm you share K with the server or

discover that you share it only with a man-in-the-middle. Also, be sure your solution will not be discovered by a packet sniffer. What will be an ideal response?

Computer Science & Information Technology