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()
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()); } }
answers:
a.
a class method
b.
a getter method
c.
a setter method
d.
a public method
e.
a static method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
