Gibberish output is display when returning an array

From: Mohammed Mazid (kadmazid_at_hotmail.com)
Date: 11/28/03


Date: 28 Nov 2003 14:28:27 -0800

I changed my code as I initially used an Object arrays, I decided to
use String array instead as I can convert from a date/time to a
string.

However, when I compiled and run, it displayed a nonsense output.
Something in the nature of "java.lang.String@28934".

Here is my latest code fragment.

//This will be passed to the method displayFlights
String flight1 = "BA123";

String flightArray[] = new String[6];

for (int i = 0; i < flightArray.length; i++)
{
 out.println("<td>" );
 out.println(displayFlight(flight1));
 out.println("</td>" );
 out.println("<br>");
}
}

// Return an array of flight details
public String[] displayFlight(String flightNo)
{
 String[] flight = new String[6];
 SetupFlightDB flightDB = new SetupFlightDB();
 FlightInformation flightInfo = flightDB.flightDetails(flightNo);

 flight[0] = flightInfo.getFlightNo();
   
 java.sql.Date flightDate = flightInfo.getFlightDate();
 String dateString = String.valueOf(flightDate);
 flight[1] = dateString;

 flight[2] = flightInfo.getDestination();
  
 java.sql.Time depTime = flightInfo.getDepTime();
 String dTimeString = String.valueOf(depTime);
 flight[3] = dTimeString;

 java.sql.Time arrTime = flightInfo.getArrTime();
 String aTimeString = String.valueOf(arrTime);
 flight[4] = aTimeString;
   
 flight[5] = flightInfo.getAirline();
 return flight;
}

Basically I am trying to achieve something like this - pass a string
to the method so that from a DB table, it displays all the records
from the columns in an array style.

Can anyone suggest me some improvement to the above.

Thank you.



Relevant Pages

  • Re: Airline Routes....
    ... peice of string and pull the string taut between SFO and LHR. ... This is he great circle route and the one the pilots will try to ... There aren't many geopolitical concerns between SFO and LHR. ... I've made the flight back and forth about six times and it's ...
    (rec.travel.air)
  • Re: Teaching the aerotow
    ... - In free flight, use ailerons to get the desired bank angle, your feet to keep the string in the middle and the elevator to keep the nose at the horizon. ... stay in position using all three controls as needed and when possible try to center the string. ... The theoretical reasons for how the glider reacts to control inputs can be interesting, but you don't need to know them to fly properly. ...
    (rec.aviation.soaring)
  • Re: YASID: `string of perls
    ... and the flight is boosted by laser lauched ... refueling, the fuel tanks being refered to as `a string of ...
    (rec.arts.sf.written)
  • Update functionality error
    ... it gives me an error "The flight you selected does exist." ... it's associated details I need changing (i.e. flightdate, destination, ... arrTime and depTime). ... String destination; ...
    (comp.lang.java.help)
  • Help in French|Spanish|German translation.
    ... I am also an author of User-defined string functions. ... WORDTRANEX (cSearched, cArExpressionSought | cExpressionSough, ... each string of the array is searched ... If the parameter nArStartOccurrence is -1 or omitted, the replacement starts ...
    (microsoft.public.fox.helpwanted)