Returning String Arrays and Arrays operations in JAVA -
i writing using java. putting objects vehiclelist array , having issues returning array in getvehiclelist class. vehiclelist array of vehicle[]. keep getting "string cannot converted string[]. hope making sense. here usetaxlist class. appreciated. thank you.
this have far , keep getting error "string cannot converted string[]". know error means, don't know how resolve it.
public vehicle[] getvehiclelist() { string[] result; (int = 0; < vehiclelist.length; i++) { result += vehiclelist[i].tostring(); } return result; }
if want convert elements vehiclelist string-objects, can write
string[] result = new string[vehiclelist.length]; (int = 0; < vehiclelist.length; i++) result[i] = vehiclelist[i].tostring(); return result;
simply write code getvehiclelist()-method. might have add custom tostring()-method in vehicle-class!
Comments
Post a Comment