I am trying to write a get method:
public void getGasConsumed()
{
int gals = miles/fuelEffiency;
return gals;
}
when I try to compile it I get the following error:
cannot return a value from method whose result type is void
return gals;
I am not understanding the problem - any help would really be appreciated.
public void getGasConsumed()
{
int gals = miles/fuelEffiency;
return gals;
}
when I try to compile it I get the following error:
cannot return a value from method whose result type is void
return gals;
I am not understanding the problem - any help would really be appreciated.