Thus, Java allows the public
, private
, or protected
keywords, or
nothing, in the place where access is determined:
public class Attraction { // Define one-parameter constructor: public Attraction (int m) {minutes = m;} // Define getter: public int getMinutes () {return minutes;} // Define setter: public void setMinutes (int m) {minutes = m;} // Declare instance variable: keyword int minutes; }