Question: The instance variables in Complex are private, but when I am executing the method plus() for a Complex object with a.plus(b), I can access not
The instance variables in Complex are private, but when I am executing the method plus() for a Complex object with a.plus(b), I can access not only a’s instance variables but also b’s. Shouldn’t b’s instance variables be inaccessible?
Q The times() method in Complex (PROGRAM 3.3.1) needs a constructor that takes polar coordinates as arguments. How can we add such a constructor?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
