Sullivan Market

a web based full-circle development system



My Java Tutorials - Accessor Methods

Methods -- Accessor Methods:
    An accesor methods return information in the form of a variable that would not normally be accessable.
The accessor method name should start with "get". This approach makes classes more reusable because
it guards against a variable being used improperly.

For Example...

1 class RaceCar {
2 String status;
3 int speed;
4 int power;
5
6 public String getCarColor( ) {
7 return this.CarColor;
8 }
9 }

Back To Java Tutorials

©2012 SullivanMarket.com