Question : You have been given following code as below.
public class ComputeSum { public int x; public int y; public int sum;
public ComputeSum(int nx, int ny) { x = nx; y = ny; updateSum(); }
public void setX(int nx) { x = nx; updateSum(); }
public void setY(int ny) { x = ny; updateSum(); }
void updateSum() { sum = x + y; } }
This class needs to protect changes on the "sum" field. Which three members must have the private access modifier to ensure that this invariant is maintained?
A. The x field B. The y field C. The sum field D. The ComputerSum ( ) constructor E. The setX ( ) method F. The setY ( ) method
Question : Which two statements are true? A. An abstract class can implement an interface. B. An abstract class can be extended by an interface. C. An interface CANNOT be extended by another interface. D. An interface can be extended by an abstract class. E. An abstract class can be extended by a concrete class. F. An abstract class CANNOT be extended by an abstract class. 1. A,B 2. B,C 3. Access Mostly Uused Products by 50000+ Subscribers 4. D,F 5. A,E
Which statement is true? 1. Both p and s are accessible by obj. 2. only s is accessible by obj. 3. Both r and s are accessible by obj. 4. p, r, and s are accessible by obj.