Consider the following Java program. Which one of the following best describes "setFlavor"? public class Food { static i

Question

Consider the following Java program. Which one of the following best describes "setFlavor"?

public class Food {

  static int count;

  private String flavor = "sweet";

  Food() { count++; }

  void setFlavor(String s) { flavor = s; }

  String getFlavor() { return flavor; }

  static public void main(String[] args) {

    Food pepper = new Food();

    System.out.println(pepper.getFlavor());

  }

}

Select one:

a. a class method

b. a getter method

c. a setter method

d. a public method

e. a static method

Details
Purchase An Answer Below

Have a similar question?