I am currently using Java and I am trying to get my getVehicleList method to print out its contents from Vehicle[] vehicleList. However, when I call my getVehicleList, it returns LVehicle;@61443d8f
instead.
I think this is the memory address if I am correct. I am not sure if this is relevant, but here is an example of what it should print out. Thank you.
Jones, Jo: Car 2014 Honda Accord (Alternative Fuel)
Value: $22,000.00 Use Tax: $110.00
with Tax Rate: 0.005
Jones, Sam: Car 2014 Honda Accord
Value: $22,000.00 Use Tax: $220.00
with Tax Rate: 0.01
Here is the code that returns the memory address instead.
public Vehicle[] getVehicleList() {
Vehicle[] result = new Vehicle[vehicleList.length];
for (int i = 0; i < vehicleList.length; i++) {
result[i] = vehicleList[i];
}
return result;
}
This is what it prints instead.
LVehicle;@61443d8f
Here is my toString()
public String toString() {
String result = "";
for (int i = 0; i < vehicleList.length; i++) {
result += vehicleList[i] + "\n\n";
}
return result;
}