Which of the following statements is correct? a. Private fields are accessible t
ID: 3909513 • Letter: W
Question
Which of the following statements is correct? a. Private fields are accessible to all classes including than the declaring classes. Private fields are accessible to all classes excluding than the declaring classes. c. Private fields are accessible only within the declaring classes and nowhere else. d. Private fields are accessible only within the declaring classes and the Driver class 7. What does the following piece of code do? public Fraction(int numerator, int denominator) this.numerator nunerator; if(denominator e) throw new Itlega lÄrgumentException("Invalid vatue) this.denominator denominator; else ( a. Creates a Fraction object whille checking for an invariant that denominator should not b. Creates a Fraction object as long as two values of numerator and denominator is c. Creates a Fraction object but only sets the numerator field with the parameter value d. Creates a Fraction object but only sets the denominator field with the parameter be 0 passed. Does not matter what those values are that is passed via the constructor value that is passed via the constructor 8. Select from the list methods that are avallable to a java class to override. i) toString) ii) getBinaryCode() ???) isEqual() iv) equals0 a. i, i and iv b. i, ii and i c. I and iv d. I and iiExplanation / Answer
Answer 6: option c
private fields are accessible only within the declaring classes and nowhere else
=========
Answer 7: option a
Creates a Fraction object while checking for an invariant that denominator should not be 0
=========
Answer 8: option c ---> i and iv
toString() and equals() methods can be overridden
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.