I have a method that will return a String[], depending on previous user input that will determine if the parameter is "INTERNATIONAL" or "DOMESTIC". Regardless, both inputs should lead to the creation of two different String[]. When I try to compile though, I get an "missing return statement" error message. How can I fix this?
Here is my method:
public String[] typeflight(String type)
{
String type2= type.toUpperCase();
if (type2.equals("INTERNATIONAL"))
{
String[] flights = {"B738 to Melbourne, Australia ", "A380 to Beijing, China ", "F348 to London, England ", "M225 to Ontario, Canada",
"E987 to Tokyo, Japan ", "T451 to Copenhagen, Denmark ", "S501 to Seoul, South Korea ", "N778 to Venice, Italy ",
"B621 to Mexico City, Mexico ", "L454 to Rabat, Morocco ", "C998 to San Jose, Costa Rica", "H859 to Amsterdam, Netherlands "};
return flights;
}
else
if(type2.equals("DOMESTIC"))
{
String[] flights = {"459 to Seattle, Washington ", "662 to Los Angeles, California ", "712 to New Orleans, Louisiana ", "285 to Chicago, Illinois ",
"896 to Honolulu, Hawaii ", "476 to Boston, Massachusetts ", "823 to Newark, New Jersey ", "902 to Miami, Florida ",
"353 to Fort Wayne, Indiana ", "112 to Des Moines, Iowa ", "", "294 to Las Vegas, Nevada"};
return flights;
}
}
Thanks in advance!