could some one please explain to me in laymen terms why access methods are used. I know how to use methods but, I am confused about why access methods are used. I put an example from my book that uses acess methods. I hope this will help someone explain it to me.

Thanks,

Truck35

//This class is used to calculates fuel efficiency class Vehicle { private int passengers; //number of passengers private int fuelcap; //fuel capacity in gallons private int mpg; // fuel consumption in miles per gallon //This is a constructor for Vehicle. Vehicle (int p, int f, int m) { passengers = p; fuelcap = f; mpg = m; } //Return the range. int range() { return mpg * fuelcap; } //Compute fuel needed for a given distance. double fuelneeded(int miles){ return (double) miles/mpg; } //These are the access methods I was talking about. //The book says they are for instance variables. int getPassengers() {return passengers;} void setPassengers(int p) {passengers = p;} int getFuelcap () {return fuelcap;} void getFuelcap (int f) {fuelcap = f;} int getMpg() {return mpg;} void getMpg (int m) { mpg = m;} }