52.0k views
24 votes
Given the following class, public class Magazine { private static double SUBSCRIPTION_DISCOUNT = .60; private String title;

private String publisher;
private double newsstandPrice;
public Magazine(String theTitle, String thePublisher, double theNewsPrice) {
title = theTitle;
publisher = thePublisher;
newsstandPrice = theNewsPrice;
}
public String getTitle() {
return title;
}
public String getPublisher() {
return publisher;
}
public double getNewsstandPrice() {
return newsstandPrice;
}
public double getSubscriptionPrice() {
// implementation not shown
public void setNewsstandPrice(double newPrice) {
newsstandPrice = newPrice;
}
}
Which of the following methods is an accessor method?
I. getTitle
II. getPublisher
III. setNewsstandPrice

I only
I and II only
II only
I and III only
III only

User Mdubez
by
3.5k points

1 Answer

8 votes

Answer:

The answer is "III only"

Step-by-step explanation:

An accessor method is also an instance function that receives or establishes the value of an object's properties. This method is called methods through obtaining information about an entity. This method reverses it to process, which has two accessory string techniques to reach source string data reference length Accessor method.

User Connor Bishop
by
3.5k points