Consider a Rational class designed to represent rational numbers as a pair of int's, along with methods reduce (to reduce the rational to simplest form) , gcd (to find the greatest common divisor of two int's) , as well as methods for addition, subtraction, multiplication, and division. Why should the reduce and gcd methods be declared to be private.
A) Because they will never be used
B) Because they will only be called from methods inside of Rational
C) Because they will only be called from the constructor of Rational
D) Because they do not use any of Rational's instance data
E) Because it is a typo and they should be declared as public
Correct Answer:
Verified
Q3: The behavior of an object is defined
Q4: Which of the following reserved words in
Q5: A class' constructor usually defines
A) how an
Q7: In order to preserve encapsulation of an
Q9: An example of passing message to a
Q12: For the questions below, use the following
Q13: To define a class that will represent
Q21: Having multiple class methods of the same
Q28: If a method does not have a
Q37: Consider a sequence of method invocations as
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents