Question: Need Help with these multiple choices. Question 1 1 pts A mutator method may modify a class' fields True O False Question 2 1 pts
Need Help with these multiple choices.



Question 1 1 pts A mutator method may modify a class' fields True O False Question 2 1 pts Given the following code, which method is NOT an accessor? public class Restaurant { private Strinn name: Question 2 1 pts Given the following code, which method is NOT an accessor? public class Restaurant { private String name; private int rating; public void setName(String n) {name = n; } public void setRating(String r) { rating = r; } public String getName() {return name;} public int getRating0) {return rating;} public void print() { System.out.println(rating); } } O print setName O getName O getRating Question 7 1 pts What should be in setNumYears to set the field numYears to 0? public class Spaceship { private int numYears; public void add NumYears(int numYears) { } } Spaceship.numYears = 0; this.numYears = 0; O numYears = 0; this(numYears) = 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
